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
 The current saved text value.
void setText (const WString &text)
 Set the current text.
WLineEditlineEdit () const
 Access the line edit.
WPushButtonsaveButton () const
 Access the save button.
WPushButtoncancelButton () const
 Access the cancel button.

Public Attributes

Signal< WStringvalueChanged
 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.

Example:

   // ..

   new WText("Name: ", app->root());
   WInPlaceEdit *edit = new WInPlaceEdit("Bob Smith", app->root());
   edit->setStyleClass("inplace");

   // ...

   // the corresponding style sheet, e.g. using an inline stylesheet
   app->styleSheet().addRule("*.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


Generated on Fri Sep 12 17:01:14 2008 for Wt by doxygen 1.5.6