175 views
in GUI Development by

Hi team,

I created one class - Application::condition_popup_scr_update & created one method cond_popup_status(arg1, arg2) inside of this class (Application::condition_popup_scr_update)

I have created a object of the above class in global class (Application::Device) to use globally.

I have multiple component classes in my project like [Application::Homescreen, Application::MainScreen, Application::camera, Application::popup...]

I am calling the method  cond_popup_status(arg1, arg2) inside one of the Component class (E.g - Application::Homescreen)periodically.

Method calling format -Application::Device.condition_popup_scr_update.cond_popup_status(arg1,arg2);

 

Inside of the method cond_popup_status(arg1, arg2)  - I am checking some conditions & switching to one dialog (e.g - Application::camera)

i am following the below way in my method to switch the dialog: -

parent = (Core::Group)parentthis;

root = parent? parent.GetRoot() : null;

if(root)
{
  root.SwitchToDialog(new Application::camera,null, null, null, null, null, null, null, null, null, false );
}
 

But i am getting the parent & root is always null.

Please give your solution for above problem.

One more doubt- Is there any options are available to call the method of one class from other component class without direct function call ()?

1 Answer

0 votes
by

Hello Gayathri,

I have created a object of the above class in global class (Application::Device) to use globally.

the Device object is not an instance of Core::Group. Consequently (Core::Group)parentthis will result in null.

One more doubt- Is there any options are available to call the method of one class from other component class without direct function call ()?

A method can be called in context of an instance only.

I hope it helps you further.

Best regards

Paul Banach

by

Thanks for your comment paul.

I have attached sample project for your reference to understand the problem, which i am facing.

Dialog_issue

Example;

1)Created Main_Screen, Camera_popup & info_popup component classes.

2)Created popup_property ,  popup_update class. & Device_class(for global access).

3)Created object of popup_property ,  popup_update classes into Device_class. & popup_list[] array to map the 2 screens.

4)created object of popup_update class in all class_component of my project. since popup will display based on some conditions, so every standard screen we need to check the condition.

5) if any change in totl_record from outside, it will trigger the method (cond_popup_status) from popup_update class.

6)from that method - line num 20 - SwitchTodialog is working.

7)After switching into info popup (or) camera_popup- I need to dismissdialog, if timer expired. [line-33]

but i am getting root is null in this case.

 

How can we resolve this? 

 

Note: i need to use switchTodialog & dismissdialog in this method to use across the many screens based on some conditions.

 

 

by

Hello Gayathri,

since I can't start your application and so no reproduce the issue it is difficult to reconstruct the exact cause of the problem. I would recommend to set a breakpoint at the line 30 and evaluate the conditions leading to it. However, based on the project review I suppose the following cause: The object popup_update within Device_Class is performing the code. As mentioned above, in Device object you can't obtain access to the root object. Consequently parent and root variables in this object are null. To fix such issue:

Option 1: Don't use Device object to perform UI operation. It is intended to act as 'device interface'. Instead let the Device object trigger a System Event, which then can be processed in e.g. Application component.

Option 2: Let the Device object store a reference to the Application (root) object. For this purpose the Application component needs to assign 'itself' to a variable existing the Device object. Then the Device object can use the variable.

Option 3: If you are working with EW 12 you can access the root object via the global variable rootthis.

Best regards

Paul Banach

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

...