What is the difference between delete and deatroy?

hi ,everyone , i am confused by the following program
require ‘gtk2’
button = Gtk::Button.new(“Hello World”)
button.signal_connect(“clicked”) {
puts “Hello World”
}
window = Gtk::Window.new
window.signal_connect(“delete_event”) {
puts “delete event occurred”
false
}
window.signal_connect(“destroy”) {
puts “destroy event occurred”
Gtk.main_quit
}
window.border_width = 10
window.add(button)
button.show
window.show
window.show_all
Gtk.main
why connect two signal handlers to the window:delete_event,destroy?
mybe one is enough: destroy
1.what is the difference between delete and deatroy?
2.the folowing can run too
require ‘gtk2’
button = Gtk::Button.new(“Hello World”)
button.signal_connect(“clicked”) {
puts “Hello World”
}
window = Gtk::Window.new
window.signal_connect(“destroy”) {
puts “destroy event occurred”
Gtk.main_quit
}
window.border_width = 10
window.add(button)
button.show
window.show
window.show_all
Gtk.main

any advice can be appreciated .

2010/8/10, Pen T. [email protected]:

}
why connect two signal handlers to the window:delete_event,destroy?
puts “destroy event occurred”

[email protected]
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en

Hi.

When you try to close a window, the delete_event event is sent. If
there is no associed block or if it returns false, then the destroy
event is sent.
delete_event event can be used to interact with the user before the
window is actually detroyed. Usually it is used to present an confirm
dialog (“Are you sure you want to quit ?”).


Vincent C.


This SF.net email is sponsored by

Make an app they can’t live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs