how to get the position of a GtkWidget



I try to get the position and size of a GtkWidget (such as a button),
which is put in a GtkWindow

First, I try to get it from gtkwidget->allocation.x,
gtkwidget->allocation.y....
But failed, never get it, seems it is always empty.

Then, I try to get it through this way:
1.    realize the widget using gtk_widget_realize(..)
2.    then using gdk_window_get_position(...) and
gdk_window_get_size(..)

But, all failed.

I don't know why.
I wonder how I can get the position and size of a GtkWidget? (especially
the position(x,y) of a widget in the window)

if someone knows, please tell me ASAP!!

Thanks!!!

Jiang






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