Class Fox::FXList
In: FXList.rb
../lib/fox/iterators.rb
Parent: FXScrollArea

List

Events

The following messages are sent by FXList to its target:

SEL_CHANGED:sent when the current list item changes; the message data is an Integer indicating the index of the current item.
SEL_COMMAND:sent when the current list item changes; the message data is an Integer indicating the index of the current item.
SEL_KEYPRESS:sent when a key goes down; the message data is an FXEvent instance.
SEL_KEYRELEASE:sent when a key goes up; the message data is an FXEvent instance.
SEL_LEFTBUTTONPRESS:sent when the left mouse button goes down; the message data is an FXEvent instance.
SEL_LEFTBUTTONRELEASE:sent when the left mouse button goes up; the message data is an FXEvent instance.
SEL_RIGHTBUTTONPRESS:sent when the right mouse button goes down; the message data is an FXEvent instance.
SEL_RIGHTBUTTONRELEASE:sent when the right mouse button goes up; the message data is an FXEvent instance.
SEL_CLICKED:sent when a list item is single-clicked; the message data is an Integer indicating the index of the current item.
SEL_DOUBLECLICKED:sent when a list item is double-clicked; the message data is an Integer indicating the index of the current item.
SEL_TRIPLECLICKED:sent when a list item is triple-clicked; the message data is an Integer indicating the index of the current item.
SEL_SELECTED:sent when a list item is selected; the message data is an Integer indicating the index of the selected item.
SEL_DESELECTED:sent when a list item is deselected; the message data is an Integer indicating the index of the deselected item.
SEL_REPLACED:sent when a list item is about to be replaced; the message data is an Integer indicating the index of the item to be replaced.
SEL_INSERTED:sent after a list item is inserted; the message data is an Integer indicating the index of the item that was inserted.
SEL_DELETED:sent when a list item is about to be removed; the message data is an Integer indicating the index of the item to be removed.

List styles

LIST_EXTENDEDSELECT:Extended selection mode allows for drag-selection of ranges of items
LIST_SINGLESELECT:Single selection mode allows up to one item to be selected
LIST_BROWSESELECT:Browse selection mode enforces one single item to be selected at all times
LIST_MULTIPLESELECT:Multiple selection mode is used for selection of individual items
LIST_AUTOSELECT:Automatically select under cursor
LIST_NORMAL:same as LIST_EXTENDEDSELECT

Message identifiers

ID_TIPTIMER:: ID_LOOKUPTIMER::

Methods
appendItem    appendItem    clearItems    deselectItem    disableItem    each    enableItem    extendSelection    findItem    getItemAt    getItemData    getItemHeight    getItemIcon    getItemText    getItemWidth    hitItem    insertItem    insertItem    itemCurrent?    itemEnabled?    itemSelected?    itemVisible?    killSelection    makeItemVisible    new    prependItem    prependItem    removeItem    replaceItem    replaceItem    retrieveItem    selectItem    setCurrentItem    setItemData    setItemIcon    setItemText    sortItems    toggleItem    updateItem   
Attributes
anchorItem  [R] 

Index of anchor item, or -1 if no anchor item [Integer]

currentItem  [RW] 

Index of current item, or -1 if no current item [Integer]

cursorItem  [R] 

Index of item under the cursor, or -1 if none [Integer]

font  [RW] 

Text font [FXFont]

helpText  [RW] 

Status line help text [String]

listStyle  [RW] 

List style [Integer]

numItems  [R] 

Number of items in the list [Integer]

numVisible  [RW] 

Number of visible items [Integer]

selBackColor  [RW] 

Selected text background color [FXColor]

selTextColor  [RW] 

Selected text color [FXColor]

textColor  [RW] 

Normal text color [FXColor]

Included modules
Enumerable
Public Class methods
new(parent, numVisible, target=nil, selector=0, opts=LIST_NORMAL, x=0, y=0, width=0, height=0) {|theList| ...}

Construct a list with numVisible visible items; the list is initially empty

Public Instance methods
retrieveItem(index)

Return the item at the given index; returns a reference to an FXListItem instance. Raises IndexError if index is out of bounds.

replaceItem(index, item, notify=false)

Replace the item at index with a (possibly subclassed) item. If notify is true, a SEL_REPLACED message is sent to the list's message target before the item is replaced. Raises IndexError if index is out of bounds.

replaceItem(index, text, icon=nil, data=nil, notify=false)

Replace the text, icon, and user data for the item at index. If notify is true, a SEL_REPLACED message is sent to the list's message target before the item is replaced. Raises IndexError if index is out of bounds.

insertItem(index, item, notify=false)

Insert a new (possibly subclassed) item at the given index. If notify is true, a SEL_INSERTED message is sent to the list's message target after the item is inserted. Raises IndexError if index is out of bounds.

insertItem(index, text, icon=nil, data=nil, notify=false)

Insert item at index with given text, icon, and user data. If notify is true, a SEL_INSERTED message is sent to the list's message target after the item is inserted. Raises IndexError if index is out of bounds.

appendItem(item, notify=false)

Append a (possibly subclassed) item to the list. If notify is true, a SEL_INSERTED message is sent to the list's message target after the item is appended.

appendItem(text, icon=nil, data=nil, notify=false)

Append a new item with given text and optional icon and user data. If notify is true, a SEL_INSERTED message is sent to the list's message target after the item is appended.

prependItem(item, notify=false)

Prepend a (possibly subclassed) item to the list. If notify is true, a SEL_INSERTED message is sent to the list's message target after the item is prepended.

prependItem(text, icon=nil, data=nil, notify=false)

Prepend a new item with given text and optional icon and user data. If notify is true, a SEL_INSERTED message is sent to the list's message target after the item is prepended.

removeItem(index, notify=false)

Remove item at index from list. If notify is true, a SEL_DELETED message is sent to the list's message target before the item is removed. Raises IndexError if index is out of bounds.

clearItems(notify=false)

Remove all items from the list If notify is true, a SEL_DELETED message is sent to the list's message target before each item is removed.

getItemWidth(index)

Return width of item at index. Raises IndexError if index is out of bounds.

getItemHeight(index)

Return height of item at index. Raises IndexError if index is out of bounds.

getItemAt(x, y)

Return index of item at (x, y), if any

hitItem(index, x, y)

Return item hit code: 0 no hit; 1 hit the icon; 2 hit the text

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.

makeItemVisible(index)

Scroll to bring item into view. Raises IndexError if index is out of bounds.

setItemText(index, text)

Change item text. Raises IndexError if index is out of bounds.

getItemText(index)

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

setItemIcon(index, icon)

Change item icon. Raises IndexError if index is out of bounds.

getItemIcon(index)

Return item icon, if any. Raises IndexError if index is out of bounds.

setItemData(index, data)

Change item user data. Raises IndexError if index is out of bounds.

getItemData(index)

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

itemSelected?(index)

Return true if item is selected. Raises IndexError if index is out of bounds.

itemCurrent?(index)

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

itemVisible?(index)

Return true if item is visible. Raises IndexError if index is out of bounds.

itemEnabled?(index)

Return true if item is enabled. Raises IndexError if index is out of bounds.

updateItem(index)

Repaint item. Raises IndexError if index is out of bounds.

enableItem(index)

Enable item. Raises IndexError if index is out of bounds.

disableItem(index)

Disable item. Raises IndexError if index is out of bounds.

selectItem(index, notify=false)

Select item. If notify is true, a SEL_SELECTED message is sent to the list's message target after the item is selected. Raises IndexError if index is out of bounds.

deselectItem(index, notify=false)

Deselect item. If notify is true, a SEL_DESELECTED message is sent to the list's message target after the item is deselected. Raises IndexError if index is out of bounds.

toggleItem(index, notify=false)

Toggle item selection state. If notify is true, either a SEL_SELECTED or SEL_DESELECTED message is sent to the list's message target to indicate the item's new state. Raises IndexError if index is out of bounds.

setCurrentItem(index, notify=false)

Change current item. If notify is true, a SEL_CHANGED message is sent to the list's message target after the current item changes. Raises IndexError if index is out of bounds.

extendSelection(index, notify=false)

Extend selection from anchor item to index. If notify is true, a series of SEL_SELECTED and SEL_DESELECTED messages are sent to the list's message target as the selected-state of different items changes. Raises IndexError if index is out of bounds.

killSelection(notify=false)

Deselect all items. If notify is true, a SEL_DESELECTED message is sent to the list's message target for all the items that were selected before killSelection was called.

sortItems()

Sort items using current sort function

each() {|aListItem| ...}

Calls block once for each item in the list, passing a reference to that item as a parameter.