Re:Closing a window.



Hi,
You should read the comment first.For example,

/* If you return FALSE in the "delete_event" signal handler,
     * GTK will emit the "destroy" signal. Returning TRUE means
     * you don't want the window to be destroyed.
     * This is useful for popping up 'are you sure you want to quit?'
     * type dialogs. */

so,just replace "TRUE" with "FALSE",then the "destroy" signal will be emit,and the "destroy" callback 
function will be called to destroy the window. 


在2009-05-29,"Sunburned Surveyor" <sunburned surveyor gmail com> 写道:
I'm a Java developer that is brand new to GTK and not the world's
greatest C programmer. (I'm acutally working with GTK in an effort to
become more familiar with C.)

I've been working through the online GTK 2 tutorial. I modified the
"hello world" example to just show a window (with no button).

I have a callback function defined for the delete_event and the
destroy event. These are connected to the GtkWindow using the
gtk_signal_connect function as shown in the "hello world" example.

However, I can't close the window with the "X" button on the window
title bar. The minimize and maximize buttons work just find. For some
reason, my code isn't catching the event that comes from the close
button on the title bar.

Can you guys give me some things to check in my code that might lead
me to the cause of the problem? Perhaps I'm messing something up with
the signal connection.

Thank you for the help.

Landon

P.S. - I'm running the example on Windows XP using the Code::Blocks IDE.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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