#include <Wt/WTextArea>
Public Member Functions | |
WTextArea (WContainerWidget *parent=0) | |
Construct a text area with empty content and optional parent. | |
WTextArea (const WString &content, WContainerWidget *parent=0) | |
Construct a text area with given content and optional parent. | |
void | setColumns (int cols) |
Set the number of columns. | |
void | setRows (int rows) |
Set the number of rows. | |
int | columns () const |
Returns the number of columns. | |
int | rows () const |
Returns the number of rows. | |
const WString & | text () const |
Returns the current content. | |
virtual void | setText (const WString &text) |
Change the content of the text area. | |
WValidator::State | validate () |
Validate the field. | |
Protected Member Functions | |
virtual int | boxPadding (Orientation orientation) const |
Returns the widget's built-in padding. | |
virtual int | boxBorder (Orientation orientation) const |
Returns the widget's built-in border width. |
To act upon text changes, connect a slot to the changed() signal. This signal is emitted when the user changed the content, and subsequently removes the focus from the line edit.
To act upon editing, connect a slot to the keyWentUp() signal.
At all times, the current content may be accessed with the text() method.
Usage example:
Wt::WContainerWidget *w = new Wt::WContainerWidget(); Wt::WLabel *label = new Wt::WLabel("Comments:", w); Wt::WTextArea *edit = new Wt::WTextArea("", w); label->setBuddy(edit);
The widget corresponds to an HTML <textarea>
tag.
WTextArea is an inline widget.
void Wt::WTextArea::setColumns | ( | int | cols | ) |
Set the number of columns.
The default value is 20.
void Wt::WTextArea::setRows | ( | int | rows | ) |
Set the number of rows.
The default value is 5.
int Wt::WTextArea::columns | ( | ) | const [inline] |
int Wt::WTextArea::rows | ( | ) | const [inline] |
void Wt::WTextArea::setText | ( | const WString & | text | ) | [virtual] |
int Wt::WTextArea::boxPadding | ( | Orientation | orientation | ) | const [protected, virtual] |
Returns the widget's built-in padding.
This is used by the layout managers to correct for a built-in padding which interferes with setting a widget's width (or height) to 100%.
A layout manager needs to set the width to 100% only for form widgets (WTextArea, WLineEdit, WComboBox, etc...). Therefore, only for those widgets this needs to return the padding (the default implementation returns 0).
For form widgets, the padding depends on the specific browser/platform combination, unless an explicit padding is set for the widget.
When setting an explicit padding for the widget using a style class, you will want to reimplement this method to return this padding in case you want to set the widget inside a layout manager.
Reimplemented from Wt::WWidget.
Reimplemented in Wt::WTextEdit.
int Wt::WTextArea::boxBorder | ( | Orientation | orientation | ) | const [protected, virtual] |
Returns the widget's built-in border width.
This is used by the layout managers to correct for a built-in border which interferes with setting a widget's width (or height) to 100%.
A layout manager needs to set the width to 100% only for form widgets (WTextArea, WLineEdit, WComboBox, etc...). Therefore, only for those widgets this needs to return the border width (the default implementation returns 0).
For form widgets, the border width depends on the specific browser/platform combination, unless an explicit border is set for the widget.
When setting an explicit border for the widget using a style class, you will want to reimplement this method to return this border width, in case you want to set the widget inside a layout manager.
Reimplemented from Wt::WWidget.
Reimplemented in Wt::WTextEdit.