Re: Why "GtkWidget->window" is "NULL" when "gtk_window_new()"



On Mon, 2008-08-11 at 17:45 +0800, Wu Yin wrote:
> Code:
> +----------------------------------------------------------
> | GtkWidget *w;
> |
> | w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> +----------------------------------------------------------
> Why the "w->window" is "NULL"?

the GdkWindow is created after a widget is realized (except for
NO_WINDOW widgets).

> The GdkDrawable is NULL ,how can I draw things on it?

use the "realize" signal: connect a callback to that signal and you're
guaranteed that widget->window will be available.

also, read the documentation:

  http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-realize

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net



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