248 views
in GUI Development by

Hello,

i have got the problem that attached observers are not called when a value within a struct is modifed. 

My class "ValueStruct" has got a Variable "Value1" and a set-function "SetValue1". On one screen I created a property of type "ValueStruct". On this screen are 2 other classes with should be connect with der property. Therefore I created for each class a reference and set them with the property. I also attached obserservers for the references for recognizing the change of Value1. But the attached slots "onUpdate" are not executed.

Can someone help?

1 Answer

+1 vote
by
 
Best answer

Hello JK,

It seems, your implementation mixes references to properties with regular references to objects. The notifyobservers operations is applied on an instance of the class ValueStruct. The attachobserver, in turn, registers the observer for a property. So registered observer is intended to react on notifications associated to this property.

If refStruct does refer a property, which in turn does store an instance of the ValueStruct class, perform attachobserver onUpdateRef, refStruct^. This will attach the observer to the object stored actually in the property referred by refStruct.

See also in the sections attachobserver and notififyobservers the different forms 1 and 2 with an object and property reference as 'point of interest'.

Does it help you further?

Best regards

Paul Banach

by
This solved my problem. Thank you very much.

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

...