Class Fox::FXListBox

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

List Box

### Events

The following messages are sent by FXListBox to its target:

`SEL_COMMAND`: | sent when a new list item is clicked; the message data is the index of the selected item.
`SEL_CHANGED`: | sent when a new list item is clicked; the message data is the index of the selected item.

### List Box styles

`LISTBOX_NORMAL`: | Normal style

### Message identifiers

`ID_LIST` `ID_FIELD`

Methods

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

External Aliases

<< -> appendItem

Attributes

backColor | [R] | Background color [FXColor]
currentItem | [RW] | Current item’s index, or -1 if no current item [Integer]
font | [RW] | Text font [FXFont]
helpText | [RW] | Status line help text [String]
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]
textColor | [RW] | Text color [FXColor]
tipText | [RW] | Tool tip message [String]

Included modules

Enumerable

Public Class methods

new(p, nvis, tgt=nil, sel=0, opts=FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL, x=0, y=0, w=0, h=0, pl=DEFAULT_PAD, pr=DEFAULT_PAD, pt=DEFAULT_PAD, pb=DEFAULT_PAD) {|theListBox| ...}

Returns an initialized FXListBox instance.

Public Instance methods

itemCurrent?(index)

Return `true` if index is the index of 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, icon=nil, ptr=nil)

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

insertItem(index, text, icon=nil, ptr=nil)

Insert a new item at index. Raises IndexError if index is out of bounds.

appendItem(text, icon=nil, ptr=nil)

Add an item to the end of the list.

prependItem(text, icon=nil, ptr=nil)

Prepend an item to the list

removeItem(index)

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

clearItems()

Remove all items from the list

findItem(text, start=-1, flags=SEARCH_FORWARD|SEARCH_WRAP)

Search items for item by name, starting from start item; the flags argument controls the search direction, and case sensitivity.

setItemText(index, text)

Set text for specified item to text. Raises IndexError if index is out of bounds.

getItemText(index)

Return text for specified item. Raises IndexError if index is out of bounds.

setItemIcon(index, icon)

Set icon for specified item to icon. Raises IndexError if index is out of bounds.

getItemIcon(index)

Return icon for specified item. Raises IndexError if index is out of bounds.

setItemData(index, ptr)

Set user data object for specified item to ptr. Raises IndexError if index is out of bounds.

getItemData(index)

Return user data object for specified item. Raises IndexError if index is out of bounds.

paneShown?()

Return `true` if the pane is shown.

sortItems()

Sort items using current sort function

each() {|getItemText(i), getItemIcon(i), getItemData(i)| ...}

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