Re: cannot set value of GtkDial



On Tue, 2003-06-03 at 10:18, Peter Van Osta wrote:
> Hi,
> 
> I have created a GtKDial which I want to show the system load in %, but
> it doesn't repsond to the values i use to set  it in the first place,
> nothing happens. For backward compatibility it is written in GTK 1.2.

Compatibility with what? Writing new code against a toolkit version
that is no longer maintained just doesn't make sense to me.

> gboolean on_dial1_expose_event  (GtkWidget       *widget,
>                                         GdkEventExpose  *event,
>                                         gpointer         user_data)
> {
> 	gfloat val = 50.0;
> 	gtk_dial_set_percentage ( GTK_DIAL( widget ), val );
> 	fprintf( stdout, "System load: %.1f\n", val );
> 	return FALSE;
> }

Probably would be better to ask this on gnome-devel-list, since GtkDial
is not a GTK+ widget.... (it appears in the GTK+ tutorial, but as
a not-meant-to-be-complete example of how to *write* a widget. Then
somebody decided that they actually wanted the widget and put it
into libgnomeui...)

But this code really doesn't make any sense. Why would you set the
percentage when the widget was redrawn? You'll liable to put your
program into a nice infinite loop that way. I'd expect the value to
be set when the system load changed.

> I also have tried to find the reference of the command to get a pointer
> to a widget by using its name, so I do not ahve to use global varaiables
> to manipulate widgets from outside a callback function ?

Both of your examples have sort of a "glade generated code" look,
so see:

http://lists.ximian.com/archives/public/glade-devel/2003-February/000015.html

Regards,
                                             Owen





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