- From: Owen Taylor <owt1 cornell edu>
- To: gtk-list redhat com
- Subject: Re: GtkRange??
- Date: 07 Apr 1998 12:40:17 -0400
Orlando Andico <firstname.lastname@example.org> writes:
> On Mon, 6 Apr 1998, Jonathan Belson wrote:
> > Hi
> > Hope I'm not making myself sound stupid, but I can't figure out how
> > to extract a value from a Range widget...I can set up a callback for
> > when the slider is moved (using gtkmm), but I can't read what it's changed to
> > 8^/ Can anyone elucidate, or point me to a piece of example code?
> This is one of the things I hate about GTK+ !!!
> You DON'T extract values from a scale widget (what I assume you mean the
> range is) in fact you can't even attach a callback to a ^%^*$%@# scale..
> you attach the callback to the associated ADJUSTMENT widget, and extract
> values like so..
> value = GTK_ADJUSTMENT(mywidget)->value;
If this is the biggest complaint you have about GTK. Then, well,
I'm happy. ;-)
adj = gtk_adjustment_new (value, upper, lower, step_increment,
range = gtk_hscale_new (adj);
gtk_signal_connect (adj, "value_changed", GTK_SIGNAL_FUNC
callback (GtkAdjustment *adj, gpointer data)
g_print ("New value is %f\n", adj->value);
That doesn't exactly seem very onerous to me. Note that you
can get the adjustment from the range with:
gtk_range_get_adjustment (GTK_RANGE (range))
Note that an Adjustment is a a GtkObject, but not a GtkWidget.
] [Thread Prev