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.addItem
Adds a text item to the choice box.
ChoiceBox.clear
Clears the choice box of all items.
ChoiceBox.deleteItem
Deletes an item with a specified index from the choice box.
ChoiceBox.findItem
Finds the index of a string in the choice box.
ChoiceBox.getItem
Gets an item from the choice box based on the specified index.
ChoiceBox.getItemCount
Gets the number of items in the choice box.
ChoiceBox.getSelectedIndex
Gets the index of the selected item in the choice box.
ChoiceBox.getValue
Gets the current text in the choice box.
ChoiceBox.insertItem
Inserts a text item at a specified index.
ChoiceBox.selectItem
Selects a choice box item at the specified index.
ChoiceBox.setItem
Sets the text of a choice box item at the specified index.
ChoiceBox.setValue
Sets the current text in the choice box.

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.addItem

function ChoiceBox.addItem(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.deleteItem

function ChoiceBox.deleteItem(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.findItem

function ChoiceBox.findItem(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.getItem

function ChoiceBox.getItem(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.getItemCount

function ChoiceBox.getItemCount() : Integer

Returns

Returns the number of items in the choice box.

Description

Returns the number of items in the choice box.

ChoiceBox.getSelectedIndex

function ChoiceBox.getSelectedIndex() : 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.getValue

function ChoiceBox.getValue() : String

Description

Returns the current text in the choice box.

ChoiceBox.insertItem

function ChoiceBox.insertItem(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.selectItem

function ChoiceBox.selectItem(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.setItem

function ChoiceBox.setItem(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.

ChoiceBox.setValue

function ChoiceBox.setValue(text : String) : Boolean

Arguments

text
The text item to set in the choice box.

Description

Sets the current text in the choice box. If the text item doesn't exist in the choice box, the function will do nothing and will return false.