84 views
in GUI Development by
Hi.

I'm using Embeeded Wizard 10.00 to target platform Win32.

I started creating an application that gets data from a file. The native function is executed in the methods slot and the data is saved in Property in the Device class. The native function data is passed correctly to the program, but when I put it in Property in Device Class and go to the next dialog box, it disappears from Property.

Below my project:

https://drive.google.com/file/d/1jTx08XK3YvDztbfqKkWar0obD-YQHsir/view?usp=sharing

1 Answer

+1 vote
by
 
Best answer

Hello,

typically, a device class is handled as an autoobject in order to have one global instance of the device class. This is very convenient, because autoobjects can be accessed from everywhere in your project.

This is also the case in your example and Application::DeviceClass is accessed as autoobject.

Please consider the livetime of autoobjects. Everytime, the autoobject is no more in use, the instance will be deleted by the Garbage Collector. When the timer expires, a new instance of the device class will be created. Within the Prototyper on PC, the Garabage Collector is running after a couple of seconds - this explains, why you get sometimes the expected value and why the content is lost after some seconds. 

In order to prevent the Garbage Collector from freeing an autoobject, please add a variable to the root class, set the type according to your device class (in your case Application::DeviceClass) and the default value to the instance (autoobject) of the class (in your case Application::Device).

Does it work?

Best regards,

Manfred.

 

by
Yes, work corectly. Thank you very much for help.

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

...