Re: Obtaining current value from a GtkHscale
- From: Ben Johnson <ben blarg net>
- To: gtk-list gnome org
- Subject: Re: Obtaining current value from a GtkHscale
- Date: Fri, 22 Jul 2005 15:55:29 -0700
On Fri, Jul 22, 2005 at 05:11:53PM -0500, Douglas Vechinski wrote:
> On Fri, 2005-07-22 at 13:31 -0700, Ben Johnson wrote:
> > On Fri, Jul 22, 2005 at 02:02:15PM -0500, Douglas Vechinski wrote:
> > >
> > > I've been searching the GTK API trying to figure out what is probably a
> > > simple question. How do I get the current value from a GtkHscale scale
> > > bar?
> > When I'm having trouble finding a function I need for a given widget,
> > especially when the need for such a function seems obvious, I start
> > looking at what the widget is a subclass of. that's what you need to do
> > in this case. I think gtk_range_get_value() is what you're looking for.
> > - Ben
> But this still requires knowing the associated GtkRange pointer. As I
a GtkHScale "is a" GtkRange. maybe you need to learn more about object
orientation? check out the object hierarchy:
GtkHScale is subclassed from GtkScale, which is subclassed from
GtkRange, which is subclassed from... blah blah blah. That means you
can treat a valid GtkHScale* as a valid GtkRange*.
GtkWidget* p = gtk_hscale_new_with_range (0, 100, 1);
gtk_widget_show( p );
printf("%f\n", gtk_range_get_value(GTK_RANGE(p)) );
as for getting the pointer to GtkHScale, look for information about
lookup_widget(). you should see it used in Glade tutorials.
] [Thread Prev