Class | Fox::FXComboBox |
In: |
rdoc-sources/FXComboBox.rb
|
Parent: | FXPacker |
An FXComboBox provides a way to select a string from a list of strings. Unless COMBOBOX_STATIC is passed, it also allows the user to enter a new string into the text field, for example if the desired entry is not in the list of strings. Passing COMBOBOX_REPLACE, COMBOBOX_INSERT_BEFORE, COMBOBOX_INSERT_AFTER, COMBOBOX_INSERT_FIRST, or COMBOBOX_INSERT_LAST causes a newly entered text to replace the current one in the list, or be added before or after the current entry, or to be added at the beginning or end of the list. FXComboBox is intended to enter text; if you need to enter a choice from a list of options, it is recommended that the FXListBox widget is used instead. When the text in the field is changed, a SEL_COMMAND will be send to the target. The FXComboBox can also receive ID_GETSTRINGVALUE and ID_SETSTRINGVALUE and so on, which will behave similar to FXTextField in that they will retrieve or update the value of the field.
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_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 |
ID_LIST: | identifier associated with the embedded FXList instance |
ID_TEXT: | identifier associated with the embedded FXTextField instance |
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] |
justify | [RW] | Text justification mode; default is JUSTIFY_LEFT [Integer] |
numColumns | [RW] | Number of columns [Integer] |
numItems | [R] | Number of items in the list [Integer] |
numVisible | [RW] | Number of visible items in the drop-down list [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] |
Return an initialized FXComboBox instance, with room to display cols columns of text.
p: | the parent widget for this combo-box [FXComposite] |
cols: | number of columns [Integer] |
target: | message target [FXObject] |
selector: | message identifier [Integer] |
opts: | the options [Integer] |
x: | initial x-position [Integer] |
y: | initial y-position [Integer] |
width: | initial width [Integer] |
height: | initial height [Integer] |
padLeft: | left-side padding, in pixels [Integer] |
padRight: | right-side padding, in pixels [Integer] |
padTop: | top-side padding, in pixels [Integer] |
padBottom: | bottom-side padding, in pixels [Integer] |
Fill combo box by appending items from strings, where strings is an array of strings. Return the number of items added.
Search for items by name, beginning from the item with index start. If the start item is -1, the search will start at the first item in the list. The search 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 name. Returns the index of the first matching item, or -1 if no matching item is found.
Search for items by associated user data, beginning from the item with index start. If the start item is -1, the search will start at the first item in the list. The search 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. Returns the index of the first matching item, or -1 if no matching item is found.
Insert a new item at index, with the specified text and user data. Raises IndexError if index is out of bounds.
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.
Set current item to index, where index is the zero-based index of the item. If notify is true, a SEL_COMMAND message is sent to the combo box‘s message target.
Replace the item at index with a new item with the specified text and user data. Raises IndexError if index is out of bounds.