#include <Wt/WInPlaceEdit>
Public Member Functions | |
WInPlaceEdit (const WString &text, WContainerWidget *parent=0) | |
Create an in-place edit with the given text. | |
const WString & | text () const |
Returns the current text value. | |
void | setText (const WString &text) |
Set the current text. | |
WLineEdit * | lineEdit () const |
Returns the line edit. | |
WPushButton * | saveButton () const |
Returns the save button. | |
WPushButton * | cancelButton () const |
Returns the cancel button. | |
Signal< WString > & | valueChanged () |
Signal emitted when the value has been changed. |
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 text mode
WInPlaceEdit edit mode
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] |
WPushButton* Wt::WInPlaceEdit::cancelButton | ( | ) | const [inline] |
Signal emitted when the value has been changed.
The signal argument provides the new value.