452 views
in GUI Development by

Hi Team,

we are facing issue is screen update in below scenario.

we are using property observer to read the system event and update the value on the screen.

first time when we receive the event a new screen is drawn over the existing screen.

after that for every 5 seconds a new value will be updated from the system which has to be refelected on the screen.

but the value is updated only first time , after the the value is not changing on the screen.

for debugging we have put trace to monitor the value , the value is updated correctly but its not reflecting on the screen.

I have attached a sample project for reference.

https://ask.embedded-wizard.de/?qa=blob&qa_blobid=7115161972398025981

please have a look at the project and suggest us if we are missing some update.

Regards,

Chaitra S G

 

1 Answer

0 votes
by

Hello Chaitra,

the problem is related to the line 3 in the method Application::Application.AlarmUpdate():

This method is called for each Property Observer notification. So far it works well. In the line 3 you create a new instance of the AlarmScreen GUI component. The problem here, each time the method is invoked a new instance is created. The following if-condition adds the AlarmScreen to the root object. This, however, is done for the first notification. The second and following notifications are processed in the else-branch. The condition modalGroup == null is false in this case because with the first notification you have one instance of AlarmScreen presented and made modal.

The code within the else-branch works correctyl. The problem is, it moddifies the objects of the just created new instance of AlarmScreen. On the screen, however, is shown the instance  created at the first notification. You should rethink the implementation of the method. Following could be one possible implementation to fix the issue. Please note the inline comments:

var Core::Root rootObject = GetRoot();
var Core::Group modalGroup = rootObject.GetModalGroup();
var string s1 = DecValue2HexString(Device.AlarmCode,2);
  if(Device.AlarmCode != 0)
  {
    if((modalGroup==null))
    {
        // If there is no modal group visible -> create a new one now
        var EWProject::AlarmScreen AlarmScreen1 = new(EWProject::AlarmScreen);

        AlarmScreen1.Alarm_Code_Text.String=s1.right( 2 );
        AlarmScreen1.IDU_Adress_Text.String = string(Device.Code2,2) + "-" + string(Device.Code1,2);
        AlarmScreen1.OnReset = Slot;
        rootObject.Add( AlarmScreen1, 0 );
        rootObject.BeginModal( AlarmScreen1 );
        trace "Alarm Code Value" + string(Device.AlarmCode);
        
    }
    else
    {
          // ... otherwise use the previously created GUI component
          var EWProject::AlarmScreen AlarmScreen1 = (EWProject::AlarmScreen)modalGroup;

          AlarmScreen1.Alarm_Code_Text.String= s1.right( 2 );
          AlarmScreen1.IDU_Adress_Text.String = string(Device.Code2,2) + "-" + string(Device.Code1,2);
          trace "Alarm Code Value" + string(Device.AlarmCode);

    }
  }

Does it help you further?

Best regards

Paul Banach

by
Hi Paul,

Its working perfect now.

 

Regards,

Chaitra S G

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

...