Connecting objects

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
bandali99
Knows some wx things
Knows some wx things
Posts: 40
Joined: Fri Jul 05, 2019 3:58 pm

Connecting objects

Post by bandali99 »

is it possible to connect two objects, if I move one of them then the other will move the same amount?

To be more clear I have created multiple sliders and I want to be able to sync them. I was thinking that I need to create a function in the widget class but I have no idea how to start it any help would be awesome
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Connecting objects

Post by doublemax »

There is nothing in wxWidgets that does this for you. You need to implement your own logic for that.

An elegant solution would be a small helper class that all sliders register to. And when one slider changes its value, this class will set the same value for all other sliders.

But you can also just add a method to the main frame that "knows" all sliders that syncs them manually.
Use the source, Luke!
Post Reply