[682] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: How do you set the initial value of a scale widget?
daemon@ATHENA.MIT.EDU (Tim Janik)
Fri Aug 8 01:15:30 1997
From: Tim Janik <timj@psynet.net>
Date: Fri, 8 Aug 1997 01:37:14 +0200 (CEST)
To: gtk-list@redhat.com
In-Reply-To: <87hgd1rh32.fsf@nevermore.csres.utexas.edu>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
On 7 Aug 1997, Rob Browning wrote:
>
> I poked around in the gtkdata, gtkadjustment, gtkrange, gtkscale, and
> gtk{h,v}scale headers and I couldn't see a way to manually set the
> value of a scale widget. Is there one?
grab the adjustment of the scale, and then call this function:
void
_gtk_adjustment_set_value (GtkAdjustment *adjustment,
gfloat value)
{
g_return_if_fail(adjustment!=NULL);
g_return_if_fail(GTK_IS_ADJUSTMENT(adjustment));
adjustment->value=CLAMP(value, adjustment->lower, adjustment->upper);
gtk_signal_emit_by_name(GTK_OBJECT(adjustment), "value_changed");
}
i had to implement this in GUBI to adjust the display portion of a GtkList
within a GtkScrolledWindow and it's working fine so far (even if i don't
like the idea of emitting signals outside of Gtk+).
HINT: i realy think something like this should go into the Gtk+ dists.
>
> Thanks
> --
> Rob
---
ciaoTJ
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null