Class Fox::FXComboBox

In: | FXComboBox.rb ../lib/fox/iterators.rb
Parent: | FXPacker

Combobox

### Events

The following messages are sent by FXComboBox to its target:

`SEL_CHANGED`: | sent when the text in the text field changes; the message data is a String containing the new text.
`SEL_COMMAND`: | sent when a new item is selected from the list, or when a command message is sent from the text field; the message data is a String containing the new text.

### ComboBox styles

`COMBOBOX_NO_REPLACE`: | Leave the list the same
`COMBOBOX_REPLACE`: | Replace current item with typed text
`COMBOBOX_INSERT_BEFORE`: | Typed text inserted before current
`COMBOBOX_INSERT_AFTER`: | Typed text inserted after current
`COMBOBOX_INSERT_FIRST`: | Typed text inserted at begin of list
`COMBOBOX_INSERT_LAST`: | Typed text inserted at end of list
`COMBOBOX_STATIC`: | Unchangable text box
`COMBOBOX_NORMAL`: | Default options for comboboxes

### Message identifiers

`ID_LIST`: | identifier associated with the embedded FXList instance
`ID_TEXT`: | identifier associated with the embedded FXTextField instance

Methods

appendItem clearItems each editable? getItemData getItemText insertItem itemCurrent? new paneShown? prependItem removeItem replaceItem retrieveItem setItemData setItemText sortItems

Attributes

backColor | [RW] | Window background color [FXColor]
comboStyle | [RW] | Combo box style [Integer]
currentItem | [RW] | Index of current item, or -1 if no current item [Integer]
editable | [W] | Editable state [Boolean]
font | [RW] | Text font [FXFont]
helpText | [RW] | Status line help text [String]
numColumns | [RW] | Number of columns [Integer]
numItems | [R] | Number of items in the list [Integer]
numVisible | [RW] | Number of visible items [Integer]
selBackColor | [RW] | Background color for selected items [FXColor]
selTextColor | [RW] | Text color for selected items [FXColor]
text | [RW] | Text [String]
textColor | [RW] | Text color [FXColor]
tipText | [RW] | Tool tip message [String]

Included modules

Enumerable

Public Class methods

new(parent, numColumns, numVisible, target=nil, selector=0, opts=COMBOBOX_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) {|theComboBox| ...}

Constructor

Public Instance methods

editable?()

Return `true` if combobox is editable

itemCurrent?(index)

Return `true` if the item at index is the current item. Raises IndexError if index is out of bounds.

retrieveItem(index)

Return the text of the item at the given index. Raises IndexError if index is out of bounds.

replaceItem(index, text, data=nil)

Replace the item at index with a new item with the specified text and user data. Raises IndexError if index is out of bounds.

insertItem(index, text, data=nil)

Insert a new item at index, with the specified text and user data. Raises IndexError if index is out of bounds.

appendItem(text, data=nil)

Append a new item to the list with the specified text and user data.

prependItem(text, data=nil)

Prepend an item to the list with the specified text and user data

removeItem(index)

Remove the item at index from the list. Raises IndexError if index is out of bounds.

clearItems()

Remove all items from the list

setItemText(index, text)

Set text for the item at index. Raises IndexError if index is out of bounds.

getItemText(index)

Get text for the item at index. Raises IndexError if index is out of bounds.

setItemData(index, data)

Set user data for the item at index. Raises IndexError if index is out of bounds.

getItemData(index)

Get data pointer for the item at index. Raises IndexError if index is out of bounds.

paneShown?()

Return `true` if the pane is shown.

sortItems()

Sort items using current sort function

each() {|itemText, itemData| ...}

Calls block once for each item in the list, passing the item’s text and user data as parameters.