#include "ginteractors.h"

class GChooser : public GInteractor

This interactor subclass represents a selectable list. The GChooser 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:

GChooser
Constructor
GChooser() Creates a chooser that initially contains no items, which are added using the addItem method.
Methods
addItem(item) Adds a new item consisting of the specified string.
getSelectedItem() Returns the current item selected in the chooser.
setSelectedItem(item) Sets the chooser so that it shows the specified item.

Constructor detail


GChooser();
Creates a chooser that initially contains no items, which are added using the 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();

Method detail


void addItem(string item);
Adds a new item consisting of the specified string.

Usage:

chooser->addItem(item);

void setSelectedItem(string item);
Sets the chooser so that it shows the specified item. If the item does not exist in the chooser, no change occurs.

Usage:

chooser->setSelectedItem(item);

string getSelectedItem();
Returns the current item selected in the chooser.

Usage:

string item = chooser->getSelectedItem();