Re: How to use get_window() function?



On Mon, 2008-08-04 at 14:19 -0300, Paulo Flabiano Smorigo wrote:
> Hi everyone,
> 
> I'm trying to use the get_window() function to get the window id of my
> gtkmm app but the function returns null.
> This is the function that I'm using:
> 
> int wid;
> Glib::RefPtr<Gdk::Window> wid = get_window();
> wid = GDK_WINDOW_XID(Glib::unwrap(get_window()));
> std::cout << "WID: " << wid << std::endl;
> 
> So, what's wrong?

get_window() can only return non-NULL after the widget has been
realized. steps in a widget's life:

	creation
	property manipulation
	show    <= covers the next two
	realize <= is assigned backend resources (e.g. an X Window)
	map   <= appears on screen
	hide  <= simple version of ...
	unmap <= removed from screen
	destroy

until realized - no window. 

in addition, many widgets have no window of their own even after they
have been "realized" - they draw in their parents' or even grandparents'
window.

--p




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