Re: [gtk-list] Drawing ???



Sergei Naumov <serge@astro.unc.edu> writes:

> One more thing. What event should I catch when a slider changes the
> value?

I'm not sure, but there may be an example in the testgtk.c example in
the gtk source tree.  If so, that may be helpful.

I've also been meaning (in my abundant spare time :>) to write
something up about sliders.  I'm not an expert, but I've used them
enough to be able to get some documentation started.

The basic idea is that every gtkrange descended widget, which includes
gtkscales, must have an associated gtkadjustment.  The adjustment
describes things like the range's minimum and maxim values, what the
page increment should be, etc.  The adjustment also is the locus
through which all the scale value manipulation callbacks are funneled.
If I understand things correctly, this is convenient in cases where
you want the motion of one slider to parallel another.  I think you
can just have them share an adjustment, but I haven't tried it.

In any case, to handle value change events, you just need to attach to
the "value_changed" signal for the adjustment you've specified for
your scale widget.  Something like this:

  scale = gtk_vscale_new(GTK_ADJUSTMENT(my_adjustment));

  gtk_signal_connect(GTK_OBJECT(my_adjustment),
                     "value_changed",
                     GTK_SIGNAL_FUNC(my_value_change_callback),
                     my_data);

Hope this is both correct and helpful...

-- 
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94  53 2B 97 F5 D6 4E 39 30



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