Class ButtonClickHelper

A CompoundClickHelper specialised for Button-like widgets. Handles pointer clicks and enter key-presses if the widget has a keyboard focus.

GenericClickHelper methods are still available, however, calls to the new methods provided by this class are preferrable; mostly they implement Widget methods.

Hierarchy

Constructors

Properties

keyboardClickHelper: GenericClickHelper

The helper for handling enter key presses

pointerClickHelper: ClickHelper

The helper for handling pointer clicks

widget: Widget

The widget that will be auto-scrolled when keyboard focused

Accessors

  • get clickStateChanged(): boolean
  • See clickStateChanged.

    Note that this does not check if the combined state has changed, it only check if any of the states in clickHelpers has changed, meaning that this can be true while clickState is equal to lastClickState. To check whether the combined state changed, compare the aforementioned values. This is the default behaviour so that clicks aren't dropped.

    Returns boolean

Methods

  • Handle event from handleEvent. Does most of the button logic.

    Returns

    Returns a 2-tuple containing, respective, whether a click occurred, and whether the event should be captured

    Parameters

    • event: Event

      The event from handleEvent

    • root: Root

      The root from handleEvent

    • enabled: boolean

      Is the button being clicked enabled? If not, then the click state will remain unchanged, but the event will be captured

    • bounds: Bounds

      The bounding box to be used for detecting pointer clicks

    Returns [wasClick: boolean, capture: boolean]

Generated using TypeDoc