SimpleCxxLib packageclass GChooser : public GInteractorGChooser constructor creates an empty chooser.
Once the chooser has been created, clients can use addItem
to add the options. For example, the following code creates a
GChooser containing the four strings
"Small", "Medium", "Large",
and "X-Large":
GChooser *sizeChooser = new GChooser();
sizeChooser->addItem("Small");
sizeChooser->addItem("Medium");
sizeChooser->addItem("Large");
sizeChooser->addItem("X-Large");
The display image of a GChooser is machine-dependent,
but the chooser generated by this code typically looks something like this:
| Constructor | |
Creates a chooser that initially contains no items, which are added using the addItem method. | |
| Methods | |
| Adds a new item consisting of the specified string. | |
| Returns the current item selected in the chooser. | |
| Sets the chooser so that it shows the specified item. | |
GChooser();
addItem method. Assigning an action command
to the chooser causes it to generate an action event whenever the
user selects an item.
Usage:
GChooser *chooser = new GChooser();
void addItem(string item);
Usage:
chooser->addItem(item);
void setSelectedItem(string item);
Usage:
chooser->setSelectedItem(item);
string getSelectedItem();
Usage:
string item = chooser->getSelectedItem();