Re: How can I get the size of a container ???



On Thu, 2005-12-15 at 07:47 -0600, Bob Caryl wrote:
> Use the Gtk::Widget::get_window method (call it from your label) to get
> a Glib::RefPtr<Gdk::Window>.  Then call the Gdk::Window::get_geometry
> method to get the dimensions of your label.

remember that you can't do this until after the widget has been
realized.

however, that won't necessarily work in this case either, since a label
has no Gdk::Window of its own, so the size reported will be the size of
the parent window, which might be very very different from the size of
the label.

signal_size_allocate() can be used to find out how much space is
allocated to a widget, regardless of whether it has its own Gdk::Window
or not.

signal_configure_event() is only emitted for top level windows, since it
is related to interactions between the app, the window manager and the
window system.

--p





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