Wt::WTextArea Class Reference

A widget that provides a multi-line edit. More...

#include <Wt/WTextArea>

Inheritance diagram for Wt::WTextArea:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WTextArea (WContainerWidget *parent=0)
 Creates a text area with empty content and optional parent.
 WTextArea (const WString &content, WContainerWidget *parent=0)
 Creates a text area with given content and optional parent.
void setColumns (int cols)
 Sets the number of columns.
void setRows (int rows)
 Sets the number of rows.
int columns () const
 Returns the number of columns.
int rows () const
 Returns the number of rows.
const WStringtext () const
 Returns the current content.
virtual void setText (const WString &text)
 Sets the content of the text area.
WValidator::State validate ()
 Validates 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.


Detailed Description

A widget that provides a multi-line edit.

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);

WTextArea is an inline widget.

CSS

The widget corresponds to an HTML <textarea> tag can be styled using inline or external CSS as appropriate. The emptyText style can be configured via .Wt-edit-emptyText.

See also:
WLineEdit

Member Function Documentation

void Wt::WTextArea::setColumns ( int  cols  ) 

Sets the number of columns.

The default value is 20.

void Wt::WTextArea::setRows ( int  rows  ) 

Sets the number of rows.

The default value is 5.

int Wt::WTextArea::columns (  )  const [inline]

Returns the number of columns.

See also:
setColumns()

int Wt::WTextArea::rows (  )  const [inline]

Returns the number of rows.

See also:
setRows()

void Wt::WTextArea::setText ( const WString text  )  [virtual]

Sets the content of the text area.

The default text is "".

Reimplemented in Wt::WTextEdit.

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.

See also:
boxBorder()

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.

See also:
boxPadding()

Reimplemented from Wt::WWidget.

Reimplemented in Wt::WTextEdit.


Generated on Fri Mar 26 17:12:07 2010 for Wt by doxygen 1.5.6