Skip to main content
MM..1
Super User
November 13, 2020
Question

TouchGFX menu multilevel variables store.

  • November 13, 2020
  • 1 reply
  • 637 views

I now try create multilevel menu system over two animated screens. My trouble is how and where store cursor and selection on any level. I create test variable int menulevel in Model , but how to access , change it in two screens? Exist any direct way or only for me chaotic usage of set get in presenters and model ?

Second is actual cursor , can be used for this any global array or better is model class properties?

Now i use this but on every entry to menu is reset to zero.

class Screen3View : public Screen3ViewBase
{
public:
 Screen3View();
 virtual ~Screen3View() {}
 virtual void setupScreen();
 virtual void tearDownScreen();
 
 virtual void scrollList1UpdateItem(MenuItem& item, int16_t itemIndex);
 virtual void curdown();
 virtual void curup();
protected:
 int cursorpos;
};
Screen3View::Screen3View() :	cursorpos(0)
{
 
}

This topic has been closed for replies.

1 reply

MM..1
MM..1Author
Super User
November 14, 2020

Nobody? I extend my question. Exist way to make screens classes persistent? This will solve this problem , where showed screen is allways reset.

When not , one way is use Model - Presenter - View or better Model - ModelListener - Presenter - View.

Second simpler is based on state , that Model class is only one primary instance and can here define global variables and share it directly to view.