There is a measuring and monitoring device. It is necessary for him to develop an interface with a bunch of different information, settings and explanations, scattered across a pile of small screens (physically, there is only one screen).

The text can be selectable and non-separable (that is, when you click the navigation buttons, nothing happens to it, for screen titles and other static signatures). It can also be editable - when, after selecting and pressing a certain button, the value of the selected parameter can be adjusted. The text can also be arranged arbitrarily enough. The font can change (from three or four different ones), for example, to specify indices along the length of a line.

Screen reader example

For the selected item you need one background, for the edited one another.

Different dynamic numerical and string values ​​can be found in the text. "The nurse has% d patties," conditionally. Conventionally, since printf and others do not use it.

And still some points that have dynamic values ​​in their composition should be redrawn regularly with actual information from sensors.

And here's the problem - how to present all these small screens (i.e., the structure of both one small screen and their relationships) in the memory of the controller. Either make some big tree from the structures describing all this, or somehow do for each small screen its own function of output and processing input. I do not know.

And so that from the control code it looks quite simple:

DrawMenu(1); while(1) { int key = GetKey(); switch(key) { case 0: OperateMenu(1, MNU_NEXTITEM); break; ... } } 

How to act competently and from where to approach this issue?

    1 answer 1

    For each case there is a solution. In my situation (Linux piece of iron), the screen was divided into areas, for example, the upper menus, the lower status bar, the middle, and so on. There is one form of redraw, in which functions are redrawn for regions on the screen. For each region of the screen, a structure was made from which it is possible to request data for redrawing. If some system modules need to be redrawn frequently and others rarely, you can add a field, for example, isNeedRepaint, which will tell you whether you need to redraw this region of the screen.