Class: Toybox.WatchUi.Selectable

Overview

A representation of an on-screen selectable object with defined states depending on selection mode.

See Also:

Note:

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

Since:

API Level 2.1.0

Direct Known Subclasses

WatchUi.Button

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var stateDefault as Graphics.ColorType or WatchUi.Drawable or Null

The default state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the default state of the Selectable

Since:

API Level 2.1.0

Returns:

var stateDisabled as Graphics.ColorType or WatchUi.Drawable or Null

The disabled state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the disabled state of the Selectable

Since:

API Level 2.1.0

Returns:

var stateHighlighted as Graphics.ColorType or WatchUi.Drawable or Null

The highlighted state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the highlighted state of the Selectable

Since:

API Level 2.1.0

Returns:

var stateSelected as Graphics.ColorType or WatchUi.Drawable or Null

The selected state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the selected state of the Selectable

Since:

API Level 2.1.0

Returns:

Instance Method Details

draw(dc as Graphics.Dc) as Void

Draw the Selectable to the device context (Dc).

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

Parameters:

Since:

API Level 2.1.0

getState() as Lang.Symbol

Get the current state of a Selectable object.

Returns:

  • Lang.Symbol

    The current state:

    • :stateDefault

    • :stateHighlighted

    • :stateSelected

    • :stateDisabled

Since:

API Level 2.1.0

initialize(options as { :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

Parameters:

See Also:

Since:

API Level 2.1.0

setState(state as Lang.Symbol) as Void

Set the current state of a Selectable object.

Parameters:

  • state(Lang.Symbol)

    The desired state:

    • :stateDefault

    • :stateHighlighted

    • :stateSelected

    • :stateDisabled

Since:

API Level 2.1.0

Throws:


Generated Sep 23, 2024, 3:32:49 PM