Re: [gtk-list] scrollbars and signals



Federico Mena wrote:
> 
> >  1) I created three scrollbars and packed them all into a vbox. Why is it
> >  that when I move one scrollbar, all three of them move?
> 
> Perhaps you initialized them with the same adjustment?  A scrollbar is
> associated to a GtkAdjustment.  When an adjustment changes value, all
> the things that are associated to it will receive notification via a
> signal.
> 
> If you want your scrollbars to be independent of each other, you
> should initialize them with different adjustments.

Hmmm. Why doesn't the scrollbar have the values associated with itself?
It doesn't seems like very good design (at least to me ;) ) to have a
scrollbar be associated with a particular adjustment. If GTK+ is OO, I
feel (note that I am not experienced in OO design) that the scrollbar
should be autonomous of a certain 'adjustment'. For example, in C++
(this may be in gtk--, I dunno), you would just have the virtual base
class GtkRange or whatever and then have the GtkScrollbar and GtkSlider
(don't remember the names) inherit the attributes of the parent.
Obviously, C doesn't have situations like this in mind, but that's just
my $0.02. :)

> >  2) What is the signal that the scrollbar emits when you move it?
> 
> Actually, it is the adjustment's signal.  It can be "changed" or "value_changed".

See above - scrollbars and the like should be independent from relying
on a common object. Creating 3 different adjustments for three different
scrollbars seems like a waste of memory and code lines to me.

Nathan



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