Is it Possible to create global variable outside the class

asked Mar 25 in System Integration by varunshatagopam
Hi Team,

Thanks for your great Support !!

I have one Query regarding the creation of Global Variable.

1 . I have created the variable inside the class and i made the global object to access that variable but when ever i want to use that varaible in different Screens i need to create an object for that instead of that is there any other option to create a global variable so that i can declare once and update accordingly without creating the instance for that .

2 .Can we create stucture in embedded Wizard because i want to pass the structure to embedded wizard project from outside of application.

varun kumar

1 Answer

0 votes
answered Mar 25 by Manfred Schweyer

Hello Varun,

Q1: If you want to have variables (e.g. to store some settings) that should be accessible from different components within your applications, you can put these variables into a separate class and create an autoobject of this class (e.g. Application::Settings). 

Please try the following:

Add a new class to your unit (e.g. Application) and rename it to Settings.

Open the class Settings and add your Properties to the class (e.g. Counter, Volume, ....).

Now, create an autoobject of the class Settings within the unit Application and rename it to GlobalSettings.

Within your application class, create a variableset the type to Application::Settings and set the initialization value to Application::Globals. This ensures that your global class is kept within the memory the whole runtime of the application.

Now you can access your global properties from everywhere in the GUI application, e.g.

Application::GlobalSettings.Volume = 5;

Application::GlobalSettings.Counter = 0;

Q2: Instead of using a structure (which contains several members), you can create a Class which contains several Variables or Properties. The data exchange between the GUI application and a Device Driver can be done by using these data types.

Does this answer your question?

Best regards,


commented Mar 25 by varunshatagopam
Hi Manfred,

Thanks for response !

Yaa its perfect

i just want to know one thing

Is there any way that if user holds the button for some time duration then the respective slot method should be called .



varun kumar
commented Mar 25 by Manfred Schweyer

Hi Varun Kumar,

in this case you can use a simple timer object. Within OnPress slot method of the button you can start the timer, and within OnRelease slot method you can stop the timer. See Implement Push Button's slot methods. When the timer expires, you can signal your desired slot method.

Best regards,


Embedded Wizard Website | Privacy Policy | Imprint