[prev in list] [next in list] [prev in thread] [next in thread]
List: gtk
Subject: Re: decent way to access "private" data of widgets
From: Havoc Pennington <hp () redhat ! com>
Date: 2000-07-26 4:38:03
[Download RAW message or body]
xander <xvw@warande0147.warande.uu.nl> writes:
> hi again,
>
> sorry for flooding this mailing list with stupid questions, but you all
> have been very helpful to me (THANKS).
>
> my question: what's the right way to access for instance the width of a
> widget? I can use gdk* functions or look deeper into the widget
> struct. Can this value be retrieved more elegantly using
> gtk_object_get_data?
>
Usually you don't want to get the size of a widget; widgets can change
size at any time.
What you want to do is _keep track of_ the size of the widget, and
update whatever data structures you're concerned about when it
changes. The way to do that is to connect to the size_allocate signal.
The last allocated size is in widget->allocation, so the current size
of a widget is widget->allocation.width by widget->allocation.height,
but this can change whenever it feels like it, and also won't be what
you expect just after you create a widget.
Havoc
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic