How to create a user menu structure

carguy:
So far, I was thinking maybe go with a struct that defines the contents of each menu screen, like so:

typedef struct {

const uint16_t*  header_left_part;
  const uint16_t*  menu_category_icon;
  const uint16_t*  submenu_number_icon;
  const uint16_t*  first_displayed_value_icon;
  const uint16_t*  second_displayed_value_icon;
  const char* firstValue;
  const char* secondValue;

} menuStruct;




I would then create menuStruct arrays for each possible submenu screen, in which the icons will be listed that are to be displayed on a particular submenu screen (all of them stored im PROGMEM), plus the two values that I want shown on that menu page. Because these values can be either float or int depending on the screen that is shown, maybe convert either values into char arrays and then have them printed on the screen that way. 

Any thoughts on that approach?

Are you sure that the elements of that struct should be constant? Including the character arrays for the numbers?

Probably better to think of a menu screen as a "how" rather than as a "what". Make a function that takes, let's say, nine arguments: the five graphics and two numbers you wish to display, along with two more numbers showing how many decimal places for each displayed number. That way, you could call it with different arguments for each menu screen.

But then, what about the settings screens? How do you intend to handle those?

In one or two of my own projects, I found it most convenient to base my design on the settings screen. Then, I could just treat a normal, "display" screen as a settings screen, but with nothing to actually set.

Consider an "old fashioned" digital watch: the kind many of us used to track the time and date before everyone got smartphones. How do you set the time on such a watch? And what does the time setting screen look like? How exactly does the time setting screen differ from a normal, time display screen?

In all seriousness, it might make more sense to "go all the way" with icons: that is, make a "number 0" icon, a "number 1" icon, and so forth, up to "number 9", and use those to display numbers. (To split a number into its digits is simple arithmetic, and requires no text manipulation.) You might also need an "infinity" icon: how many liters per 100 km when your car is idling? Once you have those icons, then you can do other things (color change? maybe a red box? I don't know how to do graphics handling) to indicate which digit and/or non-digit icon is currently being set. (Remember my "digital watch" example.)