[GH-ISSUE #564] custom menu and order control #474

Closed
opened 2026-02-28 01:25:28 +03:00 by kerem · 1 comment
Owner

Originally created by @tablatronix on GitHub (Mar 16, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/564

I am trying to figure out the easiest way to allow users to customize the menu.

I have 2 ways atm, one using a vector, so size doesnt have to be dealt with.
And (array,count) method
Both use enums for menu ids.

Alternativly using string tokens here would make this slighly easier, and I am probably going to look into that route.

  std::vector<WiFiManager::menu_page_t> menu = {wm.MENU_WIFI,wm.MENU_INFO,wm.MENU_PARAM,wm.MENU_CLOSE,wm.MENU_SEP,wm.MENU_ERASE,wm.MENU_EXIT};
  wm.setMenu(menu);

The reason I want something like this is it ties right to the menu html indexes HTTP_PORTAL_MENU[n]

Another option is builder pattern setMenu(menu << item() << item())
or
std::initializer_list and just pass arguments in
str::list

But I do not want to add dependancies that are not already needed

Originally created by @tablatronix on GitHub (Mar 16, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/564 I am trying to figure out the easiest way to allow users to customize the menu. I have 2 ways atm, one using a vector, so size doesnt have to be dealt with. And ` (array,count)` method Both use enums for menu ids. Alternativly using string tokens here would make this slighly easier, and I am probably going to look into that route. ```cpp std::vector<WiFiManager::menu_page_t> menu = {wm.MENU_WIFI,wm.MENU_INFO,wm.MENU_PARAM,wm.MENU_CLOSE,wm.MENU_SEP,wm.MENU_ERASE,wm.MENU_EXIT}; wm.setMenu(menu); ``` The reason I want something like this is it ties right to the menu html indexes HTTP_PORTAL_MENU[n] Another option is builder pattern `setMenu(menu << item() << item())` or `std::initializer_list` and just pass arguments in `str::list` But I do not want to add dependancies that are not already needed
kerem 2026-02-28 01:25:28 +03:00
Author
Owner

@tablatronix commented on GitHub (Mar 20, 2018):

I changed this to a basic token loop lookup

you can setMenu via array or vector

/*
    "wifi",
    "wifinoscan",
    "info",
    "param",
    "close",
    "restart",
    "exit",
    "erase",
    "sep"
*/
const char* menu[] = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"};
wifiManager.setMenu(menu,9);

std::vector<const char *> menu = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"};
wifiManager.setMenu(menu);
<!-- gh-comment-id:374708893 --> @tablatronix commented on GitHub (Mar 20, 2018): I changed this to a basic token loop lookup you can setMenu via array or vector ```c++ /* "wifi", "wifinoscan", "info", "param", "close", "restart", "exit", "erase", "sep" */ const char* menu[] = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"}; wifiManager.setMenu(menu,9); std::vector<const char *> menu = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"}; wifiManager.setMenu(menu); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#474
No description provided.