ListBox - Kirix Documentation

Developer Resources

ListBox

Overview

The ListBox class represents a list box control.

Base Class

FormControl

Constructor

ListBox(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

ListBox.itemActivate
Fired when a listbox item is activated.
ListBox.itemSelect
Fired when a listbox item is selected.

Methods

ListBox.addItem
Adds text to the listbox.
ListBox.clear
Clears the listbox of all items.
ListBox.deleteItem
Deletes an item from the listbox.
ListBox.deselectAllItems
Deselects all the items in the listbox.
ListBox.deselectItem
Deselects the item at the specified item index.
ListBox.findItem
Finds a listbox item with the specified text.
ListBox.getItem
Gets the listbox item at the specified position.
ListBox.getItemCount
Gets the number of items in the listbox.
ListBox.getItems
Gets an array of all listbox items.
ListBox.getSelectedIndex
Gets the index of the selected item in the listbox.
ListBox.getSelectedItem
Gets the text of the selected item in the listbox.
ListBox.getSelectedItems
Returns the selected items in the listbox.
ListBox.insertItem
Inserts a text item into the listbox at a specified position.
ListBox.isItemSelected
Indicates whether or not the specified item is selected
ListBox.selectItem
Selects the item at the specified item index.
ListBox.setItem
Sets the text at the specified item index.
ListBox.sortItems
Sorts the items in the listbox

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.

ListBox.addItem

function ListBox.addItem(text : String) : Integer

Arguments

text
The text to add to the listbox.

Returns

Returns the index of the text item that was added. If an error is encountered during the call, -1 is returned.

Description

Adds the text to the listbox and returns the index of the text item that was added.

ListBox.clear

function ListBox.clear()

Description

Clears the listbox of all items.

ListBox.deleteItem

function ListBox.deleteItem(index : Integer) : Boolean

Arguments

index
The index of the item to delete.

Returns

True if the function succeeded, false otherwise

Description

Deletes an item at the specified index from the listbox.

ListBox.deselectAllItems

function ListBox.deselectAllItems()

Description

Deselects all the items in the listbox.

ListBox.deselectItem

function ListBox.deselectItem(index : Integer)

Description

Deselects the item at the specified index.

ListBox.findItem

function ListBox.findItem(text : String, index : Integer) : Integer

Arguments

text
The text of the item to find.
index
(Optional) The zero-based index of the item to start at. If this parameter is left blank or is -1, the find operation will always start with the first item in the ListBox.

Returns

Returns the zero-based index of the item if it's found, and -1 if the item can't be found.

Description

Finds a listbox item with the specified text and returns the zero-based index of the item that was found. If the specified text item can't be found, the function returns -1.

ListBox.getItem

function ListBox.getItem(index : Integer) : String

Arguments

index
The zero-based index of the item to return.

Returns

Returns the item at the specified index.

Description

Returns the item at the specified, zero-based index item in the listbox. If the index isn't specified, the function returns the current item in the listbox.

ListBox.getItemCount

function ListBox.getItemCount() : Integer

Returns

An integer representing the number of items in the listbox.

Description

Returns the number of items in the listbox.

ListBox.getItems

function ListBox.getItems() : Array(String)

Returns

An array of strings.

Description

Returns an array of strings containing all items in the listbox.

ListBox.getSelectedIndex

function ListBox.getSelectedIndex(index : Integer) : Integer

Arguments

index
(Optional) The zero-based index of the item to start at. If this parameter is left blank or is -1, the find operation will always start with the first item in the listbox.

Returns

Returns the zero-based index of the first selected item in the listbox after the start index. If there are no selected items, the function returns -1.

Description

Returns the zero-based index of the first selected item in the listbox after the start index. If there are no selected items, the function returns -1.

ListBox.getSelectedItem

function ListBox.getSelectedItem(index : Integer) : String

Arguments

index
(Optional) The zero-based index of the item to start at. If this parameter is left blank or is -1, the find operation will always start with the first item in the listbox.

Returns

Returns the text of the first selected item in the listbox after the start index. If there is no selected item or an error occurs, null is returned.

Description

Returns the text of the first selected item in the listbox after the start index. If there are no selected items, the function returns null.

ListBox.getSelectedItems

function ListBox.getSelectedItems() : Array(String)

Returns

An Array of strings

Description

Returns an Array object containing all selected items in the listbox. If there are no selected items or an error occurs, an empty array is returned.

ListBox.insertItem

function ListBox.insertItem(text : String, index : Integer)

Arguments

text
The text to insert into the listbox.
index
The index where the text should be inserted.

Description

Inserts the text into the listbox at the position specified by index.

ListBox.isItemSelected

function ListBox.isItemSelected(index : Integer) : Boolean

Arguments

index
The index of the item being checked for selection.

Returns

Returns true if the item at the specified index is selected, and false otherwise. If an error is encountered during the call, null is returned.

Description

Indicates whether or not the item at the specified index is selected. If the item is selected, the function returns true. If the item is not selected, the function returns false.

ListBox.selectItem

function ListBox.selectItem(index : Integer)

Description

Select the item at the specified index.

ListBox.setItem

function ListBox.setItem(index : Integer, text : String)

Arguments

index
The index of the listbox item on which to set the text.
text
The new text for the item at the specified index.

Returns

True if the function succeeded, false otherwise

Description

Sets the text of the item at the specified index.

ListBox.sortItems

function ListBox.sortItems(ascending : Boolean)

Arguments

ascending
(Optional) Specifying true directs the operation to sort the control ascending, false descending.

Description

Sorts the items in the listbox. The ascending parameter, which is optional, specifies the sort order. If this parameter is not specified, an ascending sort order is assumed.