Class: Toybox::WatchUi::Button

Inherits:
Selectable show all

Overview

Note:

See the Selectable sample distributed with the SDK for an example of the use of the Button class

A representation of a Selectable button.

Button objects are mappable to a BehaviorDelegate method on selection.

See Also:

Since:

  • 2.1.0

App Types:

  • Watch Face

  • Widget

  • App

  • Audio Content Provider App

  • Glance Support

  • Background Services

Instance Attribute Summary collapse

Attributes inherited from Selectable

stateDefault, stateDisabled, stateHighlighted, stateSelected

Attributes inherited from Drawable

height, identifier, locX, locY, width

Instance Method Summary collapse

Methods inherited from Selectable

getState, setState

Methods inherited from Drawable

setLocation, setSize

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(settings) ⇒ Button

Initializes a Button object's foreground, background, and behavior. The Button must be registered during setLayout() in order to be usable.

Parameters:

Options Hash (settings):

Since:

  • 2.1.0


16001
16002
# File 'Monkeybrains.rb', line 16001

def initialize(settings)
end

Instance Attribute Details

backgroundToybox::Lang::Object

The Button background

A Drawable, Graphics.COLOR_* value, or 24-bit integer of the form 0xRRGGBB to be drawn before the current Selectable state is drawn.

Returns:

Since:

  • 2.1.0


15974
15975
15976
# File 'Monkeybrains.rb', line 15974

def background
  @background
end

behaviorToybox::Lang::Symbol

A Symbol describing the behavior method executed when button is selected.

This Symbol must be a member of the active View object's registered BehaviorDelegate, such as :onBack, but may also be a Symbol from an extended class. If the value is false or null, then a SelectableEvent will be issued.

Returns:

See Also:

Since:

  • 2.1.0


15986
15987
15988
# File 'Monkeybrains.rb', line 15986

def behavior
  @behavior
end

Instance Method Details

draw(dc) ⇒ Object

Draw the Button to the device context (Dc).

This method assumes that the device context has already been configured to the proper settings.

Parameters:

Since:

  • 2.1.0


16010
16011
# File 'Monkeybrains.rb', line 16010

def draw(dc)
end