View Full Version : how do you find the grid coordinates in a gtk+ widget

August 1st, 2012, 05:54 PM
Hello, I've recently started working with GTK+ for a very important project. Is there a way to get the grid coordinates of a widget within a given grid? I need this in order to determine which entry field is next to a given button (the number of buttons and entry fields of this type vary), and modify the field accordingly.

I am writing the program in C and I need an answer rather urgently so any help is appreciated. If there is another way to do it I'm fine with that as well.

Thanks in advance.

August 2nd, 2012, 06:19 AM
not that i have any experience with gtk but gtk_container_child_get_property() should be able to extract top-attach, left-attach, height, width of the child widget

void gtk_container_child_get_property (GtkContainer *container,
GtkWidget *child,
const gchar *property_name,
GValue *value);
container :
a GtkContainer

child :
a widget which is a child of container

property_name :
the name of the property to get

value :
a location to return the value


Child properties

"height" gint : Read / Write
"left-attach" gint : Read / Write
"top-attach" gint : Read / Write
"width" gint : Read / Write