Re: how to lock two sliders or spin buttons



On Fri, 2005-12-23 at 00:14 -0500, Amadeus W. M. wrote:
> I want to mimic the behavior of the knobs in volume control applications.
> Usually there is a knob for the left speaker and another for the right
> one, and a lock check button. If the lock is on, sliding one of the knobs
> moves the other one simultaneously.

I think these widgets can share a Gtk::Adjustment, which should make
this happen.
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch05.html

> I have two spin buttons rather than knobs, DxSpin and DySpin, and
> callbacks on_DxSpin_changed() and on_DySpin_changed(), connected each to
> the corresponding changed signal. 
> 
> >From within either callback, I read the value and set the other spin
> button to the exact same value:
> 
> on_DxSpin_changed()
> {
>   if(Lock->get_active())
>     DySpin->set_value(DxSpin->get_value());
> }
> 
> and similarly for DySpin. This naive approach produces an infinite loop,
> obviously: each time the Dx button changes the value of Dy, Dy will also
> change the value of Dy, and so on.
> 
> How do I do this? 
> 
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]