74 views
in Embedded Wizard Studio by

Hello, 

I have a problem using Variant and Overriden variables.

I try to Explain:

1) I have a GUI Class called: PROVA  with Bounds = 120,120; A rectangle as Background , color RED....and some method like Init(), DrawCircle() and so on,  to Draw a circle in the middle of the GUI by using a Chora Variable (point) called CircleSize and containing this Value <20,20>.

2) I have created the Style = [Resized];  

3) I have created a Variant of the Class PROVA called PROVA_Resized with VariantCond = [Resized]; In this Vclass I have override only the Bounds size to 320,240, the color of the rectangle Background to  YELLOW and the Chora Variable CircleSize to this size = < 50,50>.

 

If I try to Start the Prototyper with the Styles=[Resized] with Embedded Wizard Studio,  it seems to work ok (the size of The Bound is 320,240 and the Background is the one choosed), except when the method DrawCircle(); evalaute the Variable and in this case it draw the circle with 20,20 not 50,50.

Why?

To bypass this problem I have seen that I have to use one of these solution:

1) Override also the method DrawCircle that use thaeVariable, with the same code of the inherited class t(but, to me is not a good solution because I don't want to rewrite the same firmware code...) 

2) Create a slot in the original Class that invoke the method DrawCircle(), and call the slot using postsignal... This is the solution that I'm currently using but I don't like it so much.

So the question is: I'm wrong in something? Is there any other (and correct)  solution by evaluate the overriden Variable of the VariantClass?

 

Thank you in advance.

1 Answer

0 votes
by

Hello Emanuele Orsi,

I suppose the method DrawCircle() is invoked in context of the Init method of class PROVA. Is this the case?

If yes, please note that classes and their variants are initialized according to their inheritance. For example: the variant PROVA_Resized descends from PROVA. Therefore PROVA is initialized first. When this phase is finished, PROVA_Resized is initialized. The modifications of variables in variant PROVA_Resized are not seen during the initialization of PROVA.

I hope it helps you further.

Best regards

Paul Banach

 

by

"I suppose the method DrawCircle() is invoked in context of the Init method of class PROVA. Is this the case?"

Yes you are right.

"I hope it helps you further."

Yes, Thank you, now it's clear to me!!

Best regards, Emanuele

 

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

...