[Glade-users] Hide on delete




On 18 Oct 2009, at 23:34, Tristan Van Berkom wrote:

On Sun, Oct 18, 2009 at 11:51 AM, Peyman <paskari007 at yahoo.ca> wrote:

[...]
Tristan

I'm still a little confused as to the situation with respect to  
hide on
delete. Is this because Glade does not allow for it, or because I  
am using
glade incorrectly?

  There is no reason why you cannot connect a callback to the  
"delete-event"
and call gtk_widget_hide() from that callback - using Glade to  
design you
GTK+ interface changes nothing in this regard as far as I can see.

The fact that people may not know that they can connect to signals,
or they do not know that they should connect to the delete event
specifically - or the simple fact that they must decide whether
they desire to hide the window when its deleted, or destroy it
and build another one later... all of these facts are details of GTK+,
and it makes no difference if you use Glade or not, you still have
windows which receive delete events and if Im not mistaken the default
action is to destroy the window.

Is there anything specific with regards to using the "delete-event"  
signal that
you are having problems with ?
Hi Tristan

Yes, I am trying to prevent the delete-event signal from propagating  
further by implementing the following

def delete(...):
        print "Don't delete"
        return True

window.connect ("delete-event",delete)

of course in glade, I connect the callback in the GUI, but the  
function is the same. Now in theory the return value of true should  
stop delete-event from propagating further, but it doesn't. And I have  
tried every variation, such as on destroy, destroy-event, returning  
False, gtk.TRUE, gtk.FALSE.

The only thing I discovered is that it has something to do with the  
run() function which interferes with how the delete-event works

Cheers
Peyman Askari


Cheers,
      -Tristan





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