Wt::WComboBox Class Reference

Provides a drop-down combo-box control. More...

#include <WComboBox>

Inherits Wt::WFormWidget.

Inherited by Wt::WSelectionBox.

Inheritance diagram for Wt::WComboBox:

Inheritance graph
[legend]
List of all members.

Public Slots

void clear ()
 Clear all items.

Public Member Functions

 WComboBox (WContainerWidget *parent=0)
 Create an empty ComboBox with optional parent.
void addItem (const WString &text)
 Add an option item.
int count () const
 Get the number of items.
int currentIndex () const
 Get the currently selected item.
void insertItem (int index, const WString &text)
 Insert an option item at the specified position.
void removeItem (int index)
 Remove the option item at the specified position.
void setCurrentIndex (int index)
 Change the current selection.
void setItemText (int index, const WString &text)
 Change the text for a specified option.
const WStringcurrentText () const
 Get the text of the currently selected item.
const WStringitemText (int index) const
 Get the text of a particular item.
WValidator::State validate ()
 Validate the field.
void refresh ()
 Refresh the widget.

Public Attributes

Signal< int > activated
 Signal emitted when the selection changed.
Signal< WStringsactivated
 Signal emitted when the selection changed.

Detailed Description

Provides a drop-down combo-box control.

WComboBox is an inline widget.

A combo-box provides the user with a choice of options to chose from. Use addItem(const WString&) or insertItem(int, const WString&) to populate the combo-box. All the content can be cleared through clear().

To act on a new selection, either connect a slot to the changed() signal, or to the activated(int) or activated(const std::string) signals.

At all times, the current selection index is available through currentIndex() or the text using currentText().


Member Function Documentation

void Wt::WComboBox::addItem ( const WString text  ) 

Add an option item.

Equivalent to insertItem (count(), text).

void Wt::WComboBox::refresh (  )  [virtual]

Refresh the widget.

The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.

The widget must actualize its contents in response.

Reimplemented from Wt::WWebWidget.


The documentation for this class was generated from the following files:
Generated on Sun Jul 1 19:37:18 2007 for Wt by doxygen 1.4.7