Developer Resources

ChoiceBox

Overview

The ChoiceBox class represents a choice box control.

Base Class

FormControl

Constructor

ChoiceBox(x_pos : Integer, y_pos : Integer, width : Integer, height : Integer)

Arguments

x_pos
The x position of the control.
y_pos
The y position of the control.
width
The width of the control.
height
The height of the control.

Events

ChoiceBox.selectionChanged
Fired when the choicebox's selection has changed.

Methods

ChoiceBox.add
Adds a text item to the choice box.
ChoiceBox.clear
Clears the choice box of all items.
ChoiceBox.delete
Deletes an item with a specified index from the choice box.
ChoiceBox.findString
Finds the index of a string in the choice box.
ChoiceBox.getCount
Gets the number of items in the choice box.
ChoiceBox.getSelection
Gets the index of the selected item in the choice box.
ChoiceBox.getString
Gets an item from the choice box based on the specified index.
ChoiceBox.insert
Inserts a text item at a specified index.
ChoiceBox.isEmpty
Indicates whether or not the choice box is empty or not.
ChoiceBox.select
Selects a choice box item at the specified index.
ChoiceBox.setString
Sets the text of a choice box item at the specified index.

Inherited Methods

FormControl.captureMouse
Captures the mouse on this form control.
FormControl.disablePaint
Disables the window from redrawing itself.
FormControl.enablePaint
Enables the window to redraw itself.
FormControl.getBackgroundColor
Gets the background color of the form control.
FormControl.getClientSize
Gets the client size of the form control.
FormControl.getEnabled
Indicates whether or not a form control is enabled.
FormControl.getFont
Gets the default font for the text of form control.
FormControl.getForegroundColor
Gets the foreground color of the form control.
FormControl.getMaxSize
Gets the maximum size of the form control.
FormControl.getMinSize
Gets the minimum size of the form control.
FormControl.getMousePosition
Gets the mouse position relative to this form control.
FormControl.getNativeHandle
Gets the native handle of the window/control
FormControl.getPosition
Gets the position of a form control.
FormControl.getSize
Gets the size of the form control.
FormControl.invalidate
Invalidates a form control, which will cause it to be repainted on the next paint event.
FormControl.refresh
Refreshes a form control, which immediately repaints the entire form control.
FormControl.releaseMouse
Releases the mouse from being captured on this form control.
FormControl.setBackgroundColor
Sets the background color of the form control.
FormControl.setClientSize
Sets the client size of a form control.
FormControl.setEnabled
Enables or disables the form control.
FormControl.setFocus
Sets the focus to the form control.
FormControl.setFont
Sets the default font for the text of the form control.
FormControl.setForegroundColor
Sets the foreground color of the form control.
FormControl.setMaxSize
Sets the maximum size of a form control.
FormControl.setMinSize
Sets the minimum size of a form control.
FormControl.setPosition
Sets the position of a form control relative to the the form control's parent.
FormControl.setSize
Sets the size of a form control.
FormControl.show
Shows or hides the form control.
FormControl.update
Updates a form control, which will immediately repaint any invalid areas.

ChoiceBox.add

function ChoiceBox.add(text : String) : Integer

Arguments

text
The text to add to the list of choice box items.

Returns

Returns the index of the item that was added.

Description

Adds an item, specified by text, to the list of items in the choice box.

ChoiceBox.clear

function ChoiceBox.clear()

Description

Clears the choice box of all items.

ChoiceBox.delete

function ChoiceBox.delete(index : Integer)

Arguments

index
The index of the item to delete from the list of items in the choice box.

Description

Deletes an item with a specified index from the choice box.

ChoiceBox.findString

function ChoiceBox.findString(text : String) : Integer

Arguments

text
The text to find in the choice box.

Returns

Returns the index of the text that's found in the choice box and -1 if the text isn't found.

Description

Finds the text item in the choice box and returns it's index if it's found and -1 if it isn't found.

ChoiceBox.getCount

function ChoiceBox.getCount() : Integer

Returns

Returns the number of items in the choice box.

Description

Returns the number of items in the choice box.

ChoiceBox.getSelection

function ChoiceBox.getSelection() : Integer

Returns

Returns the index of the selected item in the choice box.

Description

Returns the index of the selected item in the choice box.

ChoiceBox.getString

function ChoiceBox.getString(index : Integer) : String

Arguments

index
The index of the item in the choice box to return.

Returns

The text item at the specified index.

Description

Returns the text item at the specified index. If index isn't specified, then the currently selected string is returned, which may include the item that's currently being entered in the choice box before it actually becomes part of the list.

ChoiceBox.insert

function ChoiceBox.insert(text : String, index : Integer)

Arguments

text
The text item to add to the choice box.
index
The index at which to insert the text in the choice box.

Description

Inserts a text item at a specified index.

ChoiceBox.isEmpty

function ChoiceBox.isEmpty() : Boolean

Returns

Returns true if the choice box does not contain any items, and false if the choice box contains items.

Description

Returns true if the choice box does not contain any items, and false if the choice box contains items.

ChoiceBox.select

function ChoiceBox.select(index : Integer)

Arguments

index
The index of the item to select in the choice box.

Description

Selects a choice box item at the specified index.

ChoiceBox.setString

function ChoiceBox.setString(index : Integer, text : String)

Arguments

index
The index of the item in the choice box for which to change the text.
text
The new text for the item at the specified index.

Description

Sets the new text of a choice box item at a specified index.