Wt::WInPlaceEdit Class Reference

A widget that provides in-place-editable text. More...

#include <Wt/WInPlaceEdit>

Inheritance diagram for Wt::WInPlaceEdit:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WInPlaceEdit (const WString &text, WContainerWidget *parent=0)
 Create an in-place edit with the given text.
const WStringtext () const
 Returns the current text value.
void setText (const WString &text)
 Set the current text.
WLineEditlineEdit () const
 Returns the line edit.
WPushButtonsaveButton () const
 Returns the save button.
WPushButtoncancelButton () const
 Returns the cancel button.
Signal< WString > & valueChanged ()
 Signal emitted when the value has been changed.


Detailed Description

A widget that provides in-place-editable text.

The WInPlaceEdit provides a text that may be edited in place by the user by clicking on it. When clicked, the text turns into a line edit with a save and cancel button.

When the user saves the edit, the valueChanged() signal is emitted.

Usage example:

 Wt::WContainerWidget *w = new Wt::WContainerWidget();
 new Wt::WText("Name: ", w);
 Wt::WInPlaceEdit *edit = new Wt::WInPlaceEdit("Bob Smith", w);
 edit->setStyleClass("inplace");

CSS stylesheet:

 .inplace span:hover {
    background-color: gray;
 }

This code will produce an edit that looks like:

WInPlaceEdit-1.png

WInPlaceEdit text mode

When the text is clicked, the edit will expand to become:
WInPlaceEdit-2.png

WInPlaceEdit edit mode


Member Function Documentation

const WString & Wt::WInPlaceEdit::text (  )  const

Returns the current text value.

See also:
setText()

void Wt::WInPlaceEdit::setText ( const WString text  ) 

Set the current text.

See also:
text()

WLineEdit* Wt::WInPlaceEdit::lineEdit (  )  const [inline]

Returns the line edit.

You may for example set a validator on the line edit.

WPushButton* Wt::WInPlaceEdit::saveButton (  )  const [inline]

Returns the save button.

See also:
cancelButton()

WPushButton* Wt::WInPlaceEdit::cancelButton (  )  const [inline]

Returns the cancel button.

See also:
saveButton()

Signal<WString>& Wt::WInPlaceEdit::valueChanged (  )  [inline]

Signal emitted when the value has been changed.

The signal argument provides the new value.


Generated on Tue Nov 3 15:34:32 2009 for Wt by doxygen 1.5.6