How to get the widget's size before it has been shown?
- From: "Lazy Fox" <lazy fox wu gmail com>
- To: gtk-list gnome org, gtk-app-devel-list gnome org
- Subject: How to get the widget's size before it has been shown?
- Date: Wed, 3 Sep 2008 18:30:25 +0800
/* 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]