Skip to main content
PKunK.1
Associate III
January 8, 2021
Solved

About using variables in TouchGFX

  • January 8, 2021
  • 7 replies
  • 4393 views

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.

0693W000006I3BmQAK.png

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Hello PKunk.1,

Completing the following tutorial should give you all the answers you need

https://support.touchgfx.com/docs/tutorials/tutorial-03

/Alexandre

7 replies

zzzzz
Senior
January 8, 2021
MM..1
Super User
January 8, 2021

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...)

PKunK.1
PKunK.1Author
Associate III
January 12, 2021

Thank you

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
January 11, 2021

Hello PKunk.1,

Completing the following tutorial should give you all the answers you need

https://support.touchgfx.com/docs/tutorials/tutorial-03

/Alexandre

PKunK.1
PKunK.1Author
Associate III
January 12, 2021

Thank you for your advice.

By the way, in the case of Adata [7], struct Adata, can you tell me how it is delivered?

Romain DIELEMAN
ST Employee
January 12, 2021

Hi,

Can you elaborate on what you are trying to do ?

/Romain