| Class | Fox::FXList |
| In: |
rdoc-sources/FXList.rb
lib/fox12/iterators.rb |
| Parent: | FXScrollArea |
A List Widget displays a list of items, each with a text and optional icon. When an item’s selected state changes, the list sends a SEL_SELECTED or SEL_DESELECTED message. A change of the current item is signified by the SEL_CHANGED message. The list sends SEL_COMMAND messages when the user clicks on an item, and SEL_CLICKED, SEL_DOUBLECLICKED, and SEL_TRIPLECLICKED when the user clicks once, twice, or thrice, respectively. When items are added, replaced, or removed, the list sends messages of the type SEL_INSERTED, SEL_REPLACED, or SEL_DELETED. In each of these cases, the index to the item, if any, is passed in the 3rd argument of the message.
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_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 |
ID_TIPTIMER:: ID_LOOKUPTIMER::
| 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] |
Append a new item with given text and optional icon and user data, e.g.
list.appendItem("pinky")
If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is appended. Returns the integer index of the newly appended item.
Append a (possibly subclassed) item to the list, e.g.
list.appendItem(FXListItem.new("pinky"))
If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is appended. Returns the integer index of the newly appended item.
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.
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.
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.
Search items for item by name, starting from start item; the flags argument controls the search direction, and case sensitivity.
Return the item at the given index; returns a reference to an FXListItem instance. Raises IndexError if index is out of bounds.
Return item user data; this is equivalent to:
getItem(index).data
Raises IndexError if index is out of bounds.
Return item icon, if any. This is equivalent to:
getItem(index).icon
Raises IndexError if index is out of bounds.
Return item text; this is equivalent to:
getItem(index).text
Raises IndexError if index is out of bounds.
Insert a new (possibly subclassed) item at the given index, e.g.
list.insertItem(1, FXListItem.new("blinky"))
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. Returns the integer index of the inserted item.
Insert item at index with given text, icon, and user data, e.g.
list.insertItem(1, "blinky")
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. Returns the integer index of the inserted item.
Return true if item is enabled; this is equivalent to:
getItem(index).enabled?
Raises IndexError if index is out of bounds.
Return true if item is selected; this is equivalent to:
getItem(index).selected?
Raises IndexError if index is out of bounds.
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.
Scroll to bring item into view. The argument is either a reference to an FXListItem instance, or the integer index of an item in the list. For the latter case, makeItemVisible raises IndexError if the index is out of bounds.
Move item from oldIndex to newIndex and return the new index of the item.. If notify is true and this move causes the current item to change, a SEL_CHANGED message is sent to the list’s message target to indicate this change in the current item. Raises IndexError if either oldIndex or newIndex is out of bounds.
Prepend a (possibly subclassed) item to the list, e.g.
list.prependItem(FXListItem.new("clyde"))
If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is prepended. Returns the integer index of the newly prepended item (which should always be zero, by definition).
Prepend a new item with given text and optional icon and user data, e.g.
list.prependItem("clyde")
If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is prepended. Returns the integer index of the newly prepended item (which should always be zero, by definition).
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.
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.
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.
Replace the item at index with a (possibly subclassed) item, e.g.
list.setItem(0, FXListItem.new("inky"))
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. Returns the integer index of the replaced item.
Replace the text, icon, and user data for the item at index, e.g.
list.setItem(0, "inky")
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. Returns the integer index of the replaced item.
Change item user data; this is equivalent to:
getItem(index).data = data
Raises IndexError if index is out of bounds.
Change item icon and mark the list’s layout as dirty; this is equivalent to:
getItem(index).icon = icon recalc
Raises IndexError if index is out of bounds.
Change item text and mark the list’s layout as dirty; this is equivalent to:
getItem(index).text = text recalc
Raises IndexError if index is out of bounds.