Class: Fox::FXListBox

Inherits:
FXPacker show all
Includes:
Enumerable
Defined in:
rdoc-sources/FXListBox.rb,
lib/fox16/iterators.rb

Overview

The List Box is a control to select one of a list of options. It looks similar to a Combo Box except that List Box yields integer numbers only. When an option is selected, List Box will send an SEL_COMMAND with the index of the opton. While manipulating the list, it may send SEL_CHANGED messages to indicate which option the cursor is hovering over. The List Box is able to receive ID_GETINTVALUE and ID_SETINTVALUE which will retrieve the current option or change the selected option.

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.

List Box styles

LISTBOX_NORMAL

Normal style

Message identifiers

ID_LIST ID_FIELD

Direct Known Subclasses

FXDriveBox

Instance Attribute Summary collapse

Attributes inherited from FXPacker

#baseColor, #borderColor, #borderWidth, #frameStyle, #hSpacing, #hiliteColor, #packingHints, #padBottom, #padLeft, #padRight, #padTop, #shadowColor, #vSpacing

Attributes inherited from FXWindow

#accelTable, #defaultCursor, #dragCursor, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y

Attributes inherited from FXDrawable

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Instance Method Summary collapse

Methods inherited from FXComposite

#maxChildHeight, #maxChildWidth

Methods inherited from FXWindow

#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, #after?, after?, #before?, before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #position, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=

Methods included from Responder2

#connect

Methods inherited from FXDrawable

#resize

Methods inherited from FXId

#create, #created?, #destroy, #detach, #runOnUiThread

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(p, target = nil, selector = 0, opts = FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXListBox

Returns an initialized FXListBox instance.



64
65
# File 'rdoc-sources/FXListBox.rb', line 64

def initialize(p, target=nil, selector=0, opts=FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theListBox
end

Instance Attribute Details

#backColorObject (readonly)

Background color Fox::FXColor



44
45
46
# File 'rdoc-sources/FXListBox.rb', line 44

def backColor
  @backColor
end

#currentItemObject

Current item’s index, or -1 if no current item [Integer]



38
39
40
# File 'rdoc-sources/FXListBox.rb', line 38

def currentItem
  @currentItem
end

#fontObject

Text font Fox::FXFont



41
42
43
# File 'rdoc-sources/FXListBox.rb', line 41

def font
  @font
end

#helpTextObject

Status line help text [String]



56
57
58
# File 'rdoc-sources/FXListBox.rb', line 56

def helpText
  @helpText
end

#numItemsObject (readonly)

Number of items in the list [Integer]



32
33
34
# File 'rdoc-sources/FXListBox.rb', line 32

def numItems
  @numItems
end

#numVisibleObject

Number of visible items [Integer]



35
36
37
# File 'rdoc-sources/FXListBox.rb', line 35

def numVisible
  @numVisible
end

#selBackColorObject

Background color for selected items Fox::FXColor



50
51
52
# File 'rdoc-sources/FXListBox.rb', line 50

def selBackColor
  @selBackColor
end

#selTextColorObject

Text color for selected items Fox::FXColor



53
54
55
# File 'rdoc-sources/FXListBox.rb', line 53

def selTextColor
  @selTextColor
end

#textColorObject

Text color Fox::FXColor



47
48
49
# File 'rdoc-sources/FXListBox.rb', line 47

def textColor
  @textColor
end

#tipTextObject

Tool tip message [String]



59
60
61
# File 'rdoc-sources/FXListBox.rb', line 59

def tipText
  @tipText
end

Instance Method Details

#appendItem(text, icon = nil, ptr = nil) ⇒ Object Also known as: <<

Add an item to the end of the list.



99
# File 'rdoc-sources/FXListBox.rb', line 99

def appendItem(text, icon=nil, ptr=nil); end

#clearItemsObject

Remove all items from the list



124
# File 'rdoc-sources/FXListBox.rb', line 124

def clearItems(); end

#eachObject

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



141
142
143
144
145
146
# File 'lib/fox16/iterators.rb', line 141

def each
  0.upto(numItems - 1) do |i|
    yield getItemText(i), getItemIcon(i), getItemData(i)
  end
  self
end

#extractItem(index) ⇒ Object

Extract item from list and return a reference to the item. Raises IndexError if index is out of bounds.



115
# File 'rdoc-sources/FXListBox.rb', line 115

def extractItem(index); end

#fillItems(strings, icon = nil, ptr = nil) ⇒ Object

Fill list by appending items from array of strings, and return the number items added.



90
# File 'rdoc-sources/FXListBox.rb', line 90

def fillItems(strings, icon=nil, ptr=nil); end

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

Search items by text, beginning from item start. If the start item is -1 the search will start at the first item in the list. Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP to control whether the search wraps at the start or end of the list. The option SEARCH_IGNORECASE causes a case-insensitive match. Finally, passing SEARCH_PREFIX causes searching for a prefix of the item text. Return -1 if no matching item is found.



136
# File 'rdoc-sources/FXListBox.rb', line 136

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

#findItemByData(data, start = -1,, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object

Search items by associated user data, beginning from item start. If the start item is -1 the search will start at the first item in the list. Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP to control whether the search wraps at the start or end of the list.



145
# File 'rdoc-sources/FXListBox.rb', line 145

def findItemByData(data, start=-1, flags=SEARCH_FORWARD|SEARCH_WRAP); end

#firstObject

Override Enumerable#first with FXWindow#first for backwards compatibility.



133
134
135
# File 'lib/fox16/iterators.rb', line 133

def first
  getFirst
end

#getItemData(index) ⇒ Object

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



181
# File 'rdoc-sources/FXListBox.rb', line 181

def getItemData(index); end

#getItemIcon(index) ⇒ Object

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



169
# File 'rdoc-sources/FXListBox.rb', line 169

def getItemIcon(index); end

#getItemText(index) ⇒ Object

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



157
# File 'rdoc-sources/FXListBox.rb', line 157

def getItemText(index); end

#insertItem(index, text, icon = nil, ptr = nil) ⇒ Object

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



96
# File 'rdoc-sources/FXListBox.rb', line 96

def insertItem(index, text, icon=nil, ptr=nil); end

#itemCurrent?(index) ⇒ Boolean

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

Returns:

  • (Boolean)


71
# File 'rdoc-sources/FXListBox.rb', line 71

def itemCurrent?(index); end

#moveItem(newIndex, oldIndex) ⇒ Object

Move item from oldIndex to newIndex and return the new index of the item. Raises IndexError if either oldIndex or newIndex is out of bounds.



109
# File 'rdoc-sources/FXListBox.rb', line 109

def moveItem(newIndex, oldIndex); end

#paneShown?Boolean

Return true if the pane is shown.

Returns:

  • (Boolean)


184
# File 'rdoc-sources/FXListBox.rb', line 184

def paneShown?; end

#prependItem(text, icon = nil, ptr = nil) ⇒ Object

Prepend an item to the list



102
# File 'rdoc-sources/FXListBox.rb', line 102

def prependItem(text, icon=nil, ptr=nil); end

#removeItem(index) ⇒ Object

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



121
# File 'rdoc-sources/FXListBox.rb', line 121

def removeItem(index); end

#retrieveItem(index) ⇒ Object

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



77
# File 'rdoc-sources/FXListBox.rb', line 77

def retrieveItem(index); end

#setItem(index, text, icon = nil, ptr = nil) ⇒ Object

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



84
# File 'rdoc-sources/FXListBox.rb', line 84

def setItem(index, text, icon=nil, ptr=nil); end

#setItemData(index, ptr) ⇒ Object

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



175
# File 'rdoc-sources/FXListBox.rb', line 175

def setItemData(index, ptr); end

#setItemIcon(index, icon, owned = false) ⇒ Object

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



163
# File 'rdoc-sources/FXListBox.rb', line 163

def setItemIcon(index, icon, owned=false); end

#setItemText(index, text) ⇒ Object

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



151
# File 'rdoc-sources/FXListBox.rb', line 151

def setItemText(index, text); end

#sortItemsObject

Sort items using current sort function



187
# File 'rdoc-sources/FXListBox.rb', line 187

def sortItems; end