In place edit
The WInPlaceEdit widget provides in-place-editable text. The
text that may be edited in place by clicking on it.
In place edit with buttons
By default, the Save and Cancel buttons are shown. To prevent losing the
widget, always use setEmptyText()
in addition to setText()
or initially setting the text by the constructor.
In place edit without buttons
To show the line edit only, call setButtonsEnabled()
with
parameter enabled
set to false; this hides the buttons. In this
mode, any event that causes focus to be lost saves the value while the
escape key cancels the editing.
#include <Wt/WContainerWidget.h>
#include <Wt/WInPlaceEdit.h>
#include <Wt/WText.h>
auto container = std::make_unique<Wt::WContainerWidget>();
Wt::WInPlaceEdit *ipe = container->addNew<Wt::WInPlaceEdit>("This is editable text");
ipe->setPlaceholderText("Enter something");
ipe->setButtonsEnabled(false);
Top