Retrieving Gtk::Widget's relative position: get_allocation() doesn't work
Posted
by a-v
on Stack Overflow
See other posts from Stack Overflow
or by a-v
Published on 2010-03-21T16:29:30Z
Indexed on
2010/03/21
16:41 UTC
Read the original article
Hit count: 336
I need to retrieve the position of a Gtk::Widget
relative to its parent, a Gtk::Table
. Most sources (e.g. http://library.gnome.org/devel/gtk-faq/stable/x642.html) say that one needs to call Gtk::Widget::get_allocation()
. However, the returned Gtk::Allocation
object always contains x = -1
, y = -1
, width = 1
, height = 1
.
I have to note that this happens before the Gtk::Table
object is actually exposed and rendered. A call to show_all_children()
or check_resize()
, which I would expect to recalculate child widget geometry, doesn't help.
What am I doing wrong? Thanks in advance.
© Stack Overflow or respective owner