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.

Example
This is editable text
source
  void InPlaceEditButtons() {
    WContainerWidget container = new WContainerWidget();
    WInPlaceEdit ipe = new WInPlaceEdit("This is editable text", (WContainerWidget) container);
    ipe.setPlaceholderText("Enter something");
  }

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.

Example
This is editable text
source
  void InPlaceEdit() {
    WContainerWidget container = new WContainerWidget();
    WInPlaceEdit ipe = new WInPlaceEdit("This is editable text", (WContainerWidget) container);
    ipe.setPlaceholderText("Enter something");
    ipe.setButtonsEnabled(false);
  }

Top