Re: finding the position of a (just created) widget
- From: Mark Leisher <mleisher crl nmsu edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: finding the position of a (just created) widget
- Date: Wed, 8 Nov 2000 10:03:09 -0700 (MST)
Julian> I don't want to know the *size* of the widget (I know that), I
Julian> want to know its position.
Having struggled a bit with this recently, what ended up working for me was
this:
gint x, y;
if (!GTK_WIDGET_REALIZED(w))
gtk_widget_realize(w);
gdk_window_get_origin(w->window, &x, &y);
If that position is not quite what you expect, try
gdk_window_get_root_origin(). Other possibilities are using gtk_widget_get()
to get the "x" and "y" values, or as a last, and not recommended at all,
reaching directly into the widget with widget->allocation.x.
But for some reason, you need to show the widget before you can actually move
it with gtk_window_reposition() or gtk_widget_set_uposition().
-----------------------------------------------------------------------------
Mark Leisher
Computing Research Lab Cinema, radio, television, magazines are a
New Mexico State University school of inattention: people look without
Box 30001, Dept. 3CRL seeing, listen without hearing.
Las Cruces, NM 88003 -- Robert Bresson
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]