Re: [gtk-list] How do you set the initial value of a scale widget?



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



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