ComboBoxKeyBehavior

Package: Libraries.Interface.Behaviors.Controls · Inherits from: Libraries.Language.Object, Libraries.Interface.Behaviors.Behavior

The ComboBoxKeyBehavior class carries out the keys of combo boxes, which ComboBoxInputSetup gives it. Each key gets its own behavior, set up with one of the constants. With the list open, Down and Up move the highlight, Home and End go to the first and last choice, Enter chooses the highlighted choice, and Escape closes the list. With the list closed, Down, Alt+Down and Up open it, Escape right after closing puts the text back, and the other keys do what they do in a text field, or elsewhere in the game.

Example Code

use Libraries.Interface.Behaviors.Controls.ComboBoxKeyBehavior
use Libraries.Game.InputSet
use Libraries.Game.InputTable
use Libraries.Interface.Events.KeyboardEvent

KeyboardEvent keys
InputSet downKey
downKey:SetKeyboardInput(keys:DOWN)

ComboBoxKeyBehavior behavior
behavior:Setup(behavior:NEXT)

InputTable table
table:SetIdentifier("MyComboBoxKeys")
table:Add(downKey, behavior)

Variables

  • integer CHOOSE: Chooses the highlighted choice and closes the list; with the list closed, the key does what it does elsewhere.
  • integer PREVIOUS: Highlights the previous choice; with the list closed, opens it.
  • integer CLOSE: Closes the list; with the list closed, right after Escape closed it, puts the text back.
  • integer NEXT: Highlights the next choice; with the list closed, opens it.
  • integer FIRST: Highlights the first choice; with the list closed, the text field's own key.
  • integer LAST: Highlights the last choice; with the list closed, the text field's own key.
  • integer OPEN: Opens the list; with the list open, highlights the next choice.

Actions

GetMove()

This action returns what the key does: OPEN, CLOSE, NEXT, PREVIOUS, FIRST, LAST or CHOOSE.

Returns

integer: What the key does.

Example

use Libraries.Interface.Behaviors.Controls.ComboBoxKeyBehavior

ComboBoxKeyBehavior behavior
integer value = behavior:GetMove()

IsFinished()

This action returns true: the key's work is done at once.

Returns

boolean: true.

Run(Libraries.Interface.Events.BehaviorEvent event)

This action carries out the key on the combo box that has the focus. The input tables call it, so most users won't need to.

Parameters

Setup(integer value)

This action chooses what the key does: OPEN, CLOSE, NEXT, PREVIOUS, FIRST, LAST or CHOOSE.

Parameters

  • value integer: What the key does.

Example

use Libraries.Interface.Behaviors.Controls.ComboBoxKeyBehavior

ComboBoxKeyBehavior behavior
behavior:Setup(behavior:CHOOSE)

Inherited Actions

6 actions from Libraries.Interface.Behaviors.Behavior
3 actions from Libraries.Language.Object