998 views
in GUI Development by

We moved from 9 to 11 last year.

This has introduced some strange issues with code generation (Something that has been in the project for some years):

if ( aState.contains( Core::ViewState[ Enabled ]) && !this.DrawDisabledOnly)
{
  this.InfoText.Opacity = 255;
  this.Icon.Opacity = 255;
}
else
{
  this.InfoText.Opacity = 255;
  this.Icon.Opacity = 255;
  this.InfoText.Color = XColours::DisabledTileTextIconColour;
  this.Icon.Color     = XColours::DisabledTileTextIconColour;
}

 

V11 produces this:

{
  /* Dummy expressions to avoid the 'C' warning 'unused argument'. */
  EW_UNUSED_ARG( aState );

  ViewsText_OnSetOpacity( &_this->Super1.InfoText, 255 );
  ViewsImage_OnSetOpacity( &_this->Super1.Icon, 255 );
}

V9 produced this:

  if ((( aState & CoreViewStateEnabled ) == CoreViewStateEnabled ) && !_this->Super1.DrawDisabledOnly )
  {
    ViewsText_OnSetOpacity( &_this->Super1.InfoText, 255 );
    ViewsImage_OnSetOpacity( &_this->Super1.Icon, 255 );
  }
  else
  {
    ViewsText_OnSetOpacity( &_this->Super1.InfoText, 255 );
    ViewsImage_OnSetOpacity( &_this->Super1.Icon, 255 );
    ViewsText_OnSetColor( &_this->Super1.InfoText, xColoursDisabledTileTextIconColour );
    ViewsImage_OnSetColor( &_this->Super1.Icon, xColoursDisabledTileTextIconColour );
  }

It runs OK in the simulator, but windows and target code is wrong and it works differently.

I can modify this to make it generate what I want, but it is a little concerning that changing versions has created issues.

 

1 Answer

+1 vote
by

Hello,

as first step I would recommend to download and install a patch for version 11. Try following steps:

Step 1: If Embedded Wizard 11.00 is running, exit it now.

Step 2: Using the following URL download the file Chora-5700.zip. Unzip this file. You will get thereupon the file Chora.dll. Its build number is 5700.

https://doc.embedded-wizard.de/data/Other/Chora-5700.zip

Step 3: Using Windows File Explorer navigate to the installation directory of Embedded Wizard 11.00. This is usually following directory:

  C:\Program Files (x86)\Embedded Wizard 11.00

Step 4: Within Embedded Wizard installation directory (from step 3) you will find the old Chora.dll file.

Step 5: Copy the new Chora.dll file (from step 2) to the installation directory of Embedded Wizard (from step 3). It replaces the older version.

Step 6: Now you can start Embedded Wizard again. The new version will be used now.

With version 11 we added a lot of optimization rules to detect and eliminate unnecessary code. In some seldom cases, the elimination produced incorrect results. The issue has been fixed officially in version 12. Let me know whether the patch has corrected the behavior.

Best regards

Paul Banach

by
Thanks for your prompt response - I will try this dll and see what happens.
by

Other idea instead of using the patch DLL. The problem is probably caused by equal code in the both blocks belonging to the if condition. The blocks start with the same code. Moving this equal code outside the if-condition should fix the issue. You can try following:

Instead of:

if ( aState.contains( Core::ViewState[ Enabled ]) && !this.DrawDisabledOnly)
{
  this.InfoText.Opacity = 255;
  this.Icon.Opacity = 255;
}
else
{
  this.InfoText.Opacity = 255;
  this.Icon.Opacity = 255;
  this.InfoText.Color = XColours::DisabledTileTextIconColour;
  this.Icon.Color     = XColours::DisabledTileTextIconColour;
}

Implement:

this.InfoText.Opacity = 255;
this.Icon.Opacity = 255;

if ( !( aState.contains( Core::ViewState[ Enabled ]) && !this.DrawDisabledOnly ))
{
  this.InfoText.Color = XColours::DisabledTileTextIconColour;
  this.Icon.Color     = XColours::DisabledTileTextIconColour;
}

Best regards

Paul

by
Yes, I'd already changed the implementation to generate the correct code - in the same was as you suggest.

My main concern was that there were other faults with the code generation.
by
In such case the provided patch should solve the issue also for all other similar cases.

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

...