341 views
in GUI Development by
Hi,

as i was working with EW and it started some strange behviour on data exchange betwwen

dialogs.

so i reinstalled the application and some chunk of my code stopped working.

for example " this.isCurrentDialog "

than i adopted the method of root object ( as you suggested in a previous post ) and it started working properly.

please suggest a good method to exchange data between dialogs.

Regards

1 Answer

+1 vote
by

Hello,

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

If there is some "strange behavior", there is never the need to reinstall the application - in this case, please describe what you have done so far and what you want to implement.

Best regards,

Manfred. 

by
Hi,

Was waiting your nswer following is what happend before reinstalling.....

1:  i created an autoobject of Main_Screen as Main_Screen1 and sucessfully posted a signal to this dialog(slot method ofcourse)

from another dialog and it was working correctly. All the variables were accessible from other dialogs in the Application.

2: the problem i faced at that point was that if i was posting a signal to update text in Main_Screen, it was not working.

but the device interface code was working , as there was an Led Attached onBoard.

3: So i did wrote  in UpdateViewState "Text_Pkey.string =  Application::Tank_Show1.Weight.String and it started to show that.

4: in that happiness ( i am sorry ) i did some other function controlling the behaviour of Main_Screen Dialog.

5 after above code adding i started the simulater , the application worked perfectly for two or three times and after

that all the signals were dead, i tried removing the code lines which i added , but even after that it did not came to right path.

6. i had a backup of my application i started that one , same behaviour i thout may be the SDL drivers are corrupted .

7. i checked some applications frome examples but the behaviour was erratic.

8. then i reinstalled the EmWiz and yhings started to work correctly.

9. i adopted your Core::Root root = GetRoot() methode and this time switchdialog was not working properly, instead i used presentdialg method

to invoke another dialog

10. so istarted searching for a proper way to address global variables and i found one of your post on that question , i did accordingly and everything is working

as required.

But now i want to deeplly understand this method of sharing global variables.

1: why i have to define a Property in Settings class

2: why i have to redefine a variable with the same name in Application::Application......what is the relation of these with each other ????

Regards

Nawaz
by

Hi Nawaz,

if you want to store some data within an object, you need a Property which represents a certain setting or a certain state. A global object (autoobject) can be used to store some global data (e.g. application settings) or to make some interaction with an underlying hardware or API. See section Property of Device Interface.

The variable within Application::Application is only necessary to keep a reference to the instance of your global settings class. This reference avoids that the Garbage Collector removes the global settings in case they are not used. Because otherwise when a certain dialog accesses the global settings later, the global class would be created again and the different settings will get their default values. See Lifetime of an autoobject.

Best regards,

Manfred.

 

by
Hi Mnfred,

Now i am understanding the hierarchy day by day as i am still in learning state ( but i think we are always in learning state )

Your explanation did a great help for me.

Thanks and Best Regards

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...