Return to Index
Choice
Parent class: Widget
The Choice widget provides a drop-down selection box that
allows the user to choose from a list of choices. The widget
displays the current string item, and presents a popup list
when the widget is clicked on. A selection event is generated
when the user changes the current selection. The drop-down
menu of the Choice widget can display a multi-level submenu.
Text of the form "Foo/Bar/Sap" will result in a toplevel item
named "foo", a submenu "bar", and an item "sap" under the "bar"
submenu. Appending "Foo/Bar/Maple" will append an item named
"maple" under the "bar" submenu. The menu structure is:
   Foo
   +-    Bar
         +-    Sap
         +-    Maple
Object Events:
Selected | The user changed the current selection. |
Choice::Choice |
Choice::Choice();
Constructs a new Choice widget. |
void Choice::setChoices |
void Choice::setChoices(const StringArray& pChoices);
Sets the choices available in the drop-down list. |
Parameters: |
const StringArray& | pChoices | The array of strings to display. |
|
StringArray Choice::getChoices |
StringArray Choice::getChoices();
Returns a StringArray with the currently available choices. |
void Choice::clear |
void Choice::clear();
Removes all the choices from the list. |
void Choice::append |
void Choice::append(const String& The);
Appends an item to the end of the list of choices. |
Parameters: |
const String& | The | new choice. |
|
int Choice::find |
int Choice::find(const String& pItem);
Determines whether a given string is one of the choices.
Returns: Returns the index of the choice, or -1 if doesn't exit. |
Parameters: |
const String& | pItem | The item to search for. |
|
int Choice::getSelection |
int Choice::getSelection();
Returns the index of the currently selected item. |
String Choice::getSelectionString |
String Choice::getSelectionString();
Returns the text of the currently selected item. |
void Choice::setSelection |
void Choice::setSelection(int pIndex);
Changes the current selection. |
Parameters: |
int | pIndex | The index of the new selection. If the index is out of the range, nothing happens. |
|
void Choice::setSelection |
void Choice::setSelection(const String& pStr);
Changes the current selection. |
Parameters: |
const String& | pStr | The string to make the current selection. Nothing happens if the string is not a choice. |
|
void Choice::setString |
void Choice::setString(int pIndex, const String& pStr);
Changes the text of one of the choices. |
Parameters: |
int | pIndex | The index of the item to change. |
const String& | pStr | The new text for the choice. |
|
String Choice::getString |
String Choice::getString(int pIndex);
Returns the text of the item at the specified index. |
Parameters: |
int | pIndex | The index of the item whose text to return. |
|
int Choice::getLength |
int Choice::getLength();
Returns the number of items in the choice. |
Generated automatically by docgen 0.0.1
© 2003 Aron Dobos