129 views
in GUI Development by
Hi,

I've created a screen as a Core::Group class as Application::Homescreen. In this class I've added a timer with period of 3000ms, so it should need to trigger a slot. Inside the slot I'm setting Timer.Enabled = false and I've added SwitchtoDialog(new Application::MenuScreen) within this slot.
Inside of Init method I'm setting Timer.Enabled = true. So after 3000ms the timer triggers the slot method and the current Homescreen is changing to MenuScreen. Later I noticed this behaviour, that is, the slot method is been triggered twice. How I found this one in the sense, I've added trace "Init is happened"; inside of Init on the first line itself. And I've added breakpoint on the first line of the slot. So after 3000ms the slot got triggered and prototyper got paused. And after I resumed the prototyper, again this slot method got triggered. And in debug window I got trace "Init is happened"; twice. This behaviour is happening for every screen and due to this our project scope of adding new screens, It's getting Init for two times whenever switched from one screen to another. I want to Init the screen for the first time only, and it should not happen again as twice.
 

Thanks & Regards

Dinesh Thirumaran

1 Answer

0 votes
by

Hello Dinesh,

your description indicates that there are multiple instances of the components existing, or the objects are instantiated twice. At first I would check the usage of SwitchToDialog(). According to your description (or I understood it so), you invoke this method in context of some dialog A to switch to dialog B. Doing this in context of dialog A will however has the effect of dialog B being presented within dialog A (nested). To switch from dialog A to dialog B you should perform SwitchToDialog() in the same context in which the dialog A was presented originally. The simplest you use Owner variable. For example, in dialog A to switch to dialog B:

Owner.SwitchToDialog( B, ... );

See also the section The methods: PresentDialog, DismissDialog and SwitchToDialog.

I hope it helps you to narrow down the issue. If not you can upload an example demonstrating it for analysis purpose.

Best regards

Paul

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

...