87 views
in GUI Development by
Hi,

First, I absolutely love this software!

Secondly, I am stuck when I am trying to make a multi-page application but I do not understand how I can call different classes to Present and Dismiss. I initially used the Init Method in the Applicaiton::Application class to dismiss the initial welcome screen (using a timer as my trigger) and show my menu/selection screen as seen in the pictures. This was easy as I was using a timer and everything was called out in Init method and Applicaiton::Welcome slot method for dismiss-dialog and present-dialog. Now, how do I call out another class/page when I am using a class group like Applicaiton::Menu? I am using the slot method to call a method but I think I am missing some key here.

Please guide me. P.S. I am a mechanical engineer and have very little knowledge about C++ and Firmware design and just now learning Embedded Wizard for a personal project.

1 Answer

0 votes
by

Hello SKhanzada,

... how do I call out another class/page when I am using a class group like Applicaiton::Menu? I am using the slot method to call a method but I think I am missing some key here.

You have implemented a slot method, which is connected to a timer. When the timer expires, the slot method performs a dismiss/present dialog operation. So far, it is clear for me. I have understood, you would like to trigger such method by other event sources. If this is true, following are the possibilities:

1. If you want the method to be triggered when the user presses a key (or hardware button) then add a Key Press Handler and connect the slot method with it.

2. If you want the method to be triggered by a touch or mouse event, you could use the Simple Touch Handler.

3. If you want the method to be triggered by a widget (e.g. Push Button), you can also connect the slot method to the widget so that activating the widget will trigger the slot method.

4. If you have created a menu containing menu items, the items can also be connected to a slot method and trigger it. I assume, you have created the menu using the available templates.

I hope it answers your question.

Best regards

Paul Banach

by


Paul, 

Thank you for replying. This is the problem I am facing right now. What should I do? 

I need to dismiss the Menu Dialog and Present Start Dialog. 

Thanks again, 

Shayan Khanzada

by

Hello Shayan,

let me first summarise what I interpret from your screenshots:

1. Application::Menu is presented at the startup time of the application as dialog.

2. When the user activates the button Start you want the actual menu component to disappear (dismiss) and show (present) the component Application::Start.

If this assumptoin is correct then following could be the steps:

Step 1: Add a slot method to the component Application::Menu. Name it e.g. onStart.

Step 2: Connect the slot method to the property OnActivate of the Push Button 'Start'.

Now, when the user activates the push button, the slot method is invoked.

Step 3: Open the slot method for editing and implement it with following code:

if ( IsCurrentDialog())
  rootthis.SwitchToDialog( new Application::Start, null, null,
                           null, null, null, null, null, null, null, false );

This operation will cause the actual (Menu) dialog to be dismissed and the new dialog (Start) to be presented. Both dialogs are managed in context of the Application component, therefore rootthis is used. The if-condition in the first row prevents eventual race conditions (see also Identify the active Dialogs and avoid race conditions).

If your application limits to switch between few dialog components (the hierarchy of dialogs is flat) and you don't want any animations during the dialog transitions, you could even simplify the implementation of the slot method to following code (see also Simplified approach to handle top-level dialogs (switching screens)):

if ( IsCurrentDialog())
  rootthis.ActiveDialog = new Application::Start;

I hope it helps you further.

Best regards

Paul

Embedded Wizard Website | Privacy Policy | Imprint

...