Re: How to get the widget's size before it has been shown?
- From: "Lazy Fox" <lazy fox wu gmail com>
- To: "Diego Jacobi" <jacobidiego gmail com>
- Cc: gtk-list gnome org
- Subject: Re: How to get the widget's size before it has been shown?
- Date: Thu, 4 Sep 2008 21:17:23 +0800
Thanks all.
On Wed, Sep 3, 2008 at 11:10 PM, Diego Jacobi
<jacobidiego gmail com> wrote:
You have to "realize" the widget before fetching the size.
2008/9/3 Lazy Fox <lazy fox wu gmail com>:
> /* How to get the widget's size before it has been shown?
> *
> * There are two "printf" statements below. I want to get the widget's size
> at the first printf.
> * How to do this?
> */
> #include <gtk/gtk.h>
>
> int main( int argc, char *argv[] )
> {
> GtkWidget *window;
> gtk_init (&argc, &argv);
>
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> printf("width=%d \n", window->allocation.width); // return 1
> gtk_widget_show (window);
> printf("width=%d \n", window->allocation.width); // return 200
> gtk_main ();
> return 0;
> }
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
--
----------------------------------------------
┏━━━━━━━━━━━━━━━━━━━━━━━━┓
┃菩提本无树,明镜亦非台。本来无一物,何处惹尘埃。┃
┗━━━━━━━━━━━━━━━━━━━━━━━━┛
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]