Class: Toybox.WatchUi.Button
- Inherits:
-
Toybox.WatchUi.Selectable
Overview
A representation of a Selectable button.
Button objects are mappable to a BehaviorDelegate method on selection.
See Also:
See the Selectable sample distributed with the SDK for an example of the use of the Button class
Instance Member Summary collapse
-
background as Graphics.ColorType or WatchUi.Drawable or Null
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.
-
behavior as Lang.Symbol or Null
A Symbol describing the behavior method executed when button is selected.
Instance Method Summary collapse
-
draw(dc as Graphics.Dc) as Void
Draw the Button to the device context (Dc).
-
initialize(options as { :behavior as Lang.Symbol, :background as Graphics.ColorType or WatchUi.Drawable, :locX as Lang.Numeric, :locY as Lang.Numeric, :width as Lang.Numeric, :height as Lang.Numeric, :stateDefault as Graphics.ColorType or WatchUi.Drawable, :stateHighlighted as Graphics.ColorType or WatchUi.Drawable, :stateSelected as Graphics.ColorType or WatchUi.Drawable, :stateDisabled as Graphics.ColorType or WatchUi.Drawable, :identifier as Lang.Object, :visible as Lang.Boolean })
Constructor Initializes a Button object's foreground, background, and behavior.
Instance Attribute Details
var background as Graphics.ColorType or WatchUi.Drawable or Null
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.
var behavior as Lang.Symbol or Null
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 null
, then a
SelectableEvent will be issued.
Instance Method Details
draw(dc as Graphics.Dc) as Void
Draw the Button to the device context (Dc).
This method assumes that the device context has already been configured to the proper options.
initialize(options as { :behavior as Lang.Symbol, :background as Graphics.ColorType or WatchUi.Drawable, :locX as Lang.Numeric, :locY as Lang.Numeric, :width as Lang.Numeric, :height as Lang.Numeric, :stateDefault as Graphics.ColorType or WatchUi.Drawable, :stateHighlighted as Graphics.ColorType or WatchUi.Drawable, :stateSelected as Graphics.ColorType or WatchUi.Drawable, :stateDisabled as Graphics.ColorType or WatchUi.Drawable, :identifier as Lang.Object, :visible as Lang.Boolean })
Constructor Initializes a Button object's foreground, background, and behavior. The Button must be registered during setLayout() in order to be usable.