Skip to main content
JDubi.1
Associate
August 10, 2022
Question

Calling screen classes directly as opposed to only frontendapplication

  • August 10, 2022
  • 5 replies
  • 1235 views

Hi all!

So in our application we want to call the screen classes themselves in c. We have setup linking header files etc and we are able to call screen transistion via the frontendapplication with:

 #include <gui_generated/main_screen/MainViewBase.hpp>
 
 void transition(void) {
static_cast<FrontendApplication(Application::getInstance())>gotoSetup_Boot_Branded_2ScreenNoTransition();
 }

But we want to call the screen classes themselves... is there an easy way to do this? I've been trying to, but only get error during compiling. Something like this:

 void transition(void) {
static_cast<MainViewBase(Mainview::getInstance())>Progress_Update();
 }

Any help would be appreciated thanks!

Best

Jacob

This topic has been closed for replies.

5 replies

MM..1
Super User
August 10, 2022

Try explain because  is there an easy way to do this? NO

JDubi.1
JDubi.1Author
Associate
August 10, 2022

What do you mean? Are you saying there is no easy way to do this?

Michael K
Senior III
August 11, 2022

This sounds a bit like an XY problem.

What larger problem are you trying to solve here?

Embedded UI/UX Consulting: cadenza.design
JDubi.1
JDubi.1Author
Associate
August 11, 2022

Hi Michael,

You mean flipping the screen in the X or Y direction? No, my problem is that I want to call the individual screen object classes in order to update things like wildcards from the backend, as of right now I can only access screen transitions from the backend with the frontendapplication, but I want to be able to access individual screens, like MainView or some other arbitrary screen. Does that make sense?

MM..1
Super User
August 11, 2022

Maybe you need more learn about C++. For TouchGFX you have two choices

  1. Use MVP and RTOS messages read docu Model-View-Presenter Design Pattern | TouchGFX Documentation
  2. Use memory struct shared variables. For example in interrupt or any other proces you change update value, and in model.tick or screen.tick you check if value changed and if yes call inside class func.
in mode ltick ...
 if((Key_Code==ENC_SEL_DN && Enc_Sel.rate>25) || RC5_Inst==IR_INPDN)
 {
 static_cast<FrontendApplication*>(Application::getInstance())->handleKeyEvent(74);
 }
 if((Key_Code==ENC_SEL_UP && Enc_Sel.rate>25) || RC5_Inst==IR_INPUP)
 {
 static_cast<FrontendApplication*>(Application::getInstance())->handleKeyEvent(73);
 }
 
in screen handletick ...
		if(SharedC_Settings.theme != 0)
		{
			SharedC_Settings.theme-=1;
			DisplayGauge(); 
		}
  1.