Page 1 of 1

Connecting objects

Posted: Wed Aug 14, 2019 6:51 pm
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

Re: Connecting objects

Posted: Wed Aug 14, 2019 7:32 pm
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.