FabGL
ESP32 Display Controller and Graphics Library

◆ menu() [2/2]

int menu ( char const *  titleText,
char const *  messageText,
StringList *  items 
)

Shows a dialog with a label and a list box. The dialog exits when an item is selected, just like a menu.

Parameters
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
Returns
Index of the selected item or -1 if dialog has been canceled

Example:

InputBox ib;
ib.begin();
StringList list;
list.append("Menu item 0");
list.append("Menu item 1");
list.append("Menu item 2");
list.append("Menu item 3");
int s = ib.menu("Menu", "Click on a menu item", &list);
ib.messageFmt("", nullptr, "OK", "You have selected %d", s);
ib.end();

Definition at line 251 of file inputbox.cpp.