neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
929 stars 189 forks source link

Feature Request: Have a way to disable a menu entry by default #425

Open ScruffR opened 10 months ago

ScruffR commented 10 months ago

I know I can call menu[1].disable(), however it would be nice if there was a way to have a way to mark a menu entry as disabled at "design time" via a style e.g.

MENU(settings, " Motor/Encoder Settings >", doNothing, noEvent, noStyle
, OP(                 " Motor        ", doNothing, anyEvent) // this should not be selectable, the curser should skip the line
, FIELD(speed       , "  Speed       ", " rpm", 1, 200, 10, 1, doNothing, noEvent, noStyle)
, FIELD(accelTime   , "  Accel.Time  ", " ms", 10, 500, 100, 0, doNothing, noEvent, noStyle)
, OP(                 " Encoder      ", doNothing, anyEvent) // this should not be selectable, the curser should skip the line
, FIELD(pulsesPerRev, "  Pulses/Rev  ", "", 100, 1200, 100, 10, doNothing, noEvent, noStyle)
, FIELD(mmPerRev    , "  mm/Rev      ", " mm", 50, 2500, 10, 1, doNothing, noEvent, noStyle)
, OP(                 "> RESTORE     ", restoreData, enterEvent)
, OP(                 "< SAVE        ", storeData, enterEvent)
);

alternatively or additionally it would be nice to have a macro (e.g. "LABEL") to add such "separators" that have not other purpose than to structure a menu. This would also allow for "virtual" footer options, where e.g. the EXIT entry was always on the bottom row of the display.

Which brings me to another suggestion: Definition of a footer sub-menu. Like in the example above it would be nice to have the RESTORE and SAVE entries pinned to the bottom row of the display left and right. As cherry on top it would be great if this footer stayed in place even when the menu "above" had more rows than the display can hold. So scrolling would only happen for the top but one rows of the display. With a bigger display it might even be nice to have a header, which stays in place to display the title.