1.0k views
in Embedded Wizard Studio by

Good Evening
I have problem with the connention between classes.

.

I have no idea how to make the connection correctly.
chartpanel1 is an autoobject of a chartpanel class.

 

1 Answer

0 votes
by

Hello,

the connections may be established between instances of the classes not between classes themselves. Precisely, in your project you can connect object A to object B, so that object A can access and e.g. invoke methods of object B.

According to your above screenshots, you have made such connection. The TogleButton in the first screenshot is connected to the slot method StartChart of the autoobject chartpanel1. Every time the user switches on the button, the slot method is signaled.

The problem here, the method is signaled in context of the particular instance chartpanel1. If your project contains another instances of the chartpanel class, these are not affected by this. For example, if you have embedded another instance of the chartpanel class inside e.g. the application component, then your project contains in fact two instances of this class. Now, when the user interacts with the ToggleButton, only the autoobject instance is affected. The other instance embedded inside the application component is not affected.

To establish the right connection, the source component (the component containing the ToggleButton) has to know the correct destination component (the right instance of the chartpanel class). Generallyt this can be achieved by:

- storing the chartpanel instance in a variable or property existing within the source component. In this manner the source component can access chartpanel instance and communicate with it.

- accessing the right object directly through the view tree

- searching for the desired chartpanel instance within the view tree.

Please see following articles:

Implementing component interface.

Understand the view tree and the Owner relationships

Enumerate and search views existing within the component

Alternatively, you can exchange information between objects by using observers, kind of broadcast infrastructure. Please see:

attachobserver

notifyobservers

 

I hope it helps you further.

Best regards

Paul Banach

by

Thank you Paul Banach for the quick answer.
Now I understand the environment more.
I used observers to solve my problem.

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...