How to get label widget size?



How could I get the size and position of a widget before its Show()
command.

I have the next scenario:
A GtkWidget  window which size is 300x300
A GtkLabel     label which text is a little string
A GtkFixed     fixed which is contained inside window

label is contained inside fixed at 10, 10 and it behaves correctly.
When I try to get the size of label with:

    gdk_window_get_geometry(label->window, &x, &y, &width, &height,
&depth);

width and height are 300 x 300!

If I try:

    gtk_widget_set_usize(GTK_WIDGET(label), 50, 10)

before the gdk_window_get_geometry(...) the label looks like 50 x 10
(incomplete shape on screen) but it still returns 300 x 300!

I also tried gdk_window_get_size(...) (of course after a
gtk_widget_show())
and it returns the same result!

How could I retrieve the real size of the label widget?

Esteban Quijano








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