2021-01-08 09:03 AM
folder is model ,main_page_screen, pw_touchgfxactivev_screen.
I want to use the variables A declared in the model in main_screen and pw_page_screen. I don't know how to declare variables and how to use them.
For example, variable A is declared in model.cpp.
In pw_touchgfxactive_screen.cpp, enter 1 for variable A.
I want to use variable A in main_page_screen.cpp.
Thank you for telling me how to pass the variable A value entered in pw_touchgfxactive to main_page_screen.cpp.
Solved! Go to Solution.
2021-01-10 07:45 PM
Hello PKunk.1,
Completing the following tutorial should give you all the answers you need
https://support.touchgfx.com/docs/tutorials/tutorial-03
/Alexandre
2021-01-08 10:00 AM
Try touchgfx MVP architectural pattern.
2021-01-08 10:23 AM
Or use extern C in C++ : example
in main.c
int variableA; or volatile
in globals.h
extern int variableA;
in model.hpp include globals.h use extern C here
then when i remmember can use variableA on any place...
But you need choice what you need C++ setters getters private public ... or C or mix, and too important is who and where will change variableA.(gui,irq,spi,dma...)
2021-01-10 07:45 PM
Hello PKunk.1,
Completing the following tutorial should give you all the answers you need
https://support.touchgfx.com/docs/tutorials/tutorial-03
/Alexandre
2021-01-11 10:56 PM
Thank you for your advice.
By the way, in the case of Adata [7], struct Adata, can you tell me how it is delivered?
2021-01-11 10:57 PM
Thank you
2021-01-12 12:57 AM
Hi,
Can you elaborate on what you are trying to do ?
/Romain
2021-01-14 04:51 PM
Model.hpp
typedrf struct TEST_DATA{
int A;
int B;
in C;
}TEST_DATA;
I would like to know if I use structure Test_Data in a place called A_Screen or if I need to return Test_Data from A_Screen as a model.