[9334] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: how to find widget size?

daemon@ATHENA.MIT.EDU (Stephan Krings)
Thu Oct 15 11:45:06 1998

Date: Thu, 15 Oct 1998 17:43:44 +0200 (CEST)
From: Stephan Krings <slothkri@zedat.fu-berlin.de>
To: gtk-list@redhat.com
In-Reply-To: <Pine.LNX.3.96.981015161516.18588D-100000@turing.idc.ul.ie>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

Hello,

> any way to find out the size (in pixels) of a widget that you have the
> pointer to.
> 
> i.e. something like 
> get_widget_size( GtkWidget *widget, gint *width, gint *height );

I both tried:

guint16 width = widget->allocation.width;
guint16 height = widget->allocation.height;

or from the Gdk-layer:

gint width, height;

gdk_window_get_size(widget->window, &width, &height);

and both solutions have worked for me.

Regards,

Stephan

-- 
Stephan Krings                                       Freie Universitaet Berlin
AG Kommunikationsserver      Zentraleinrichtung fuer Datenverarbeitung (ZEDAT)
slothkri@zedat.fu-berlin.de                                      Fabeckstr. 32
Tel: +49 30 838 3239                   				  14195 Berlin

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post