ESP32 Display Controller and Graphics Library

◆ select() [2/2]

InputResult select ( char const *  titleText,
char const *  messageText,
StringList *  items,
char const *  buttonCancelText = "Cancel",
char const *  buttonOKText = "OK" 

Shows a dialog with a label and a list box.

titleTextOptional title of the dialog (nullptr = the dialogs hasn't a title)
messageTextMessage to show
itemsStringList object containing the items to show into the listbox. This parameter contains items selected before and after the dialog
buttonCancelTextOptional text for CANCEL button (nullptr = hasn't CANCEL button). Default is "Cancel".
buttonOKTextOptional text for OK button (nullptr = hasn't OK button). Default is "OK".
Dialog box result (Cancel or Enter)


InputBox ib;
StringList list;
list.append("Option 0");
list.append("Option 1");
list.append("Option 2");
list.append("Option 3");
list.select(1, true);    // initially item 1 (Option 1) is selected
if (ib.select("Select values", "Please select one or more items", &list) == InputResult::Enter) {
  for (int i = 0; i < list.count(); ++i)
    if (list.selected(i))
      ib.messageFmt("", nullptr, "OK", "You have selected %d", i);

Definition at line 216 of file inputbox.cpp.