The WInPlaceEdit widget provides in-place-editable text. The text that may be edited in place by clicking on it.
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.
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.
void InPlaceEdit() {
WContainerWidget container = new WContainerWidget();
WInPlaceEdit ipe = new WInPlaceEdit("This is editable text", (WContainerWidget) container);
ipe.setPlaceholderText("Enter something");
ipe.setButtonsEnabled(false);
}