865 views
in Embedded Wizard Studio by

 Hi,

 

I want to implement code for update the curren screen to another screen when an event occur.

So i need to find out that which screen is displayed currently. if that perticuler screen is current screen then only i have to update to new screen otherwise not.

So please tell me about how to find which screen is display as current screen. means which parameter(variable) to follow?

Below I post a code how I change or update the screen.

 

Thanks,

Chand Bhadaniya.

 

//This is one slot method which is atteched with PushButton
//Here I update current screen with Menu screen

// Create a new instance of the Menu Dialog
var Application::MenuDialog menu = new Application::MenuDialog;

// Present the Menu Dialog now.
Owner.PresentDialog( menu, null, null, null, null, null, null, null, null, false );

 

1 Answer

0 votes
by

Hallo Chand,

the following articles address your application cases:

Identify the active Dialogs and avoid race conditions.

and

Enumerate and search for existing Dialogs.

Does it help you?

Best regards

Paul Banach

 

by
Hi Paul,

 

I try that before you suggest but i can not find perfect way.

After generating code from EWS(Embedded Wizard Studio) for Nxp controller, I have generate event from anoher task and give event to GUI_task to update screen.

So how to write in another task to update gui ?

 

Thanks,

Chand Bhadaniya
by

Hi Chand,

if I understood you correctly, you want to exchange data between two tasks, right? If yes, this is an aspect which depends on your used OS. Embedded Wizard itself does not rely/expect any OS.

Usually to exchange data between two tasks you use an interprocess communication service, e.g. message queue or pipe. In such case the extern task posts a message to one end of the message queue and the GUI task peeks the message from the other end. The GUI task will need to interpret the content of the peeked message and accordingly trigger an action in the GUI application.

In simple cases you can implement the task communication by using global variables shared by both tasks. In such case, the extern tasks sets the variable and the GUI task reads the variable. This requires the GUI task to poll the variable repeatedly. In all cases, you poll the variable or you read data from the message queue within the main loop.

To trigger an action within the GUI, the recommended approach would be to use a Device Driver class. The GUI task calls some Trigger method of the Device Driver and feeds so the message to the GUI application. Within the Device Driver you can implement the Trigger method to use e.g. the System Event object to broadcast the event to all interesting System Event Handler.

Does it answer your question?

Best regards

Paul Banach

by
Hello Paul,

Thanks for your response,

I want screen id that is displaying on LCD. Example I have two screen Home screen and Menu screen. So at present which screen is display at LCD , How can i know that?. My aim is like If only Home screen is displaying then I have to perform some task so in code I need screen information that is displaying at the moment.
by

Hello Chand,

please see my original answer. It refers the articles to query and enumerate existing dialogs. Especially the method FindCurrentDialog() returns what I understood you are looking for. 

Best regards

Paul Banach

by

Hello Chand,

maybe, what you want to achieve is to query the current dialog from the foreign task? If yes, the problem here is, you can't access GUI code from a foreign task. You will always need a kind of interprocess communication. Anyway, the idea how to do this could be:

Step1. Implement a new method (e.g. IsHomeDialogActive()) within your Application component. For example:

var Core::Group dialog = FindCurrentDialog();

// Test whether the current dialog is a special one (e.g. HomeDialog)
if ((SomeUnit::HomeDialog)dialog != null )
  return true;
else
  return false;

Step 2. Implement interprocess communication between the both tasks. The idea here, the foreign task asks the GUI task 'is home dialog active'. The GUI task invokes the method IsHomeDialogActive() in context of the root object and returns the value back to the foreign task.

Important: since the method IsHomeDialogActive() is used from the outside of the GUI application (from the GUI task), Embedded Wizard will consider it as not needed by the application itself and eliminate it. You have to supress this by setting the attribute Generator of the method brick to the value true.

Does this answer address your application case?

Best regards

Paul Banach

by
Hello Paul,

 

Thanks for your suggestion.I will try to implement this and test it.

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

...