[sigc] How to get started?



Hi again.

What I'm trying to do is have something which behaves like a double
mutually interact with some slider-like widgets, which may or may not be
presnt.

----------------------
For example, let's say my double like thing is:

  MyDouble val.

and my slider like things will be called

  window_A.slider_A

and

  window_B.slider_B

------------------------------------------

Given val and those sliders, I'd like to initialize val before the
windows are created:

  MyDouble val= 5.0;

Then I'd like to create window A and hook up the slider to pay attention
to val:

  val.connect(window_A.slider_A);

At this point, slider_A would grab the 5.0 from Val and show that to the
user.  If the user messes with slider_A, then val sholud be updated.  If
something in the code assigns something new to val, then slider_A should
be updated.

Then if window_B is created and slider_B comes into existence,

  val.connect(window_B.slider_B) would be called.

At this point, a user changing slider B should result in updating val. 
Updating val should update slider_A.  But because slider_B caused the
update in the first place, the update to val shouldn't cause an
unnessesary update to slider_B.

An assignment to val shouldn't care whether any sliders are watching
val.  A change to one slider should result in val and the other sliders
(if any) to be updated.

--------------------------------------------------------------------------

My guess is that this sort of thing is what libsigc++ does very well. 
But it's not obvious to me how to get started.

  1)  is this really suited for libsigc++?  (If not, any ideas what
might be?)
  2)  Any hints on how to get started?

Thanks.

Greg




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