[gtkada] Exiting a program from a window.

Nicolas Setton setton at adacore.com
Mon Jun 8 15:44:49 CEST 2009



Hi Rick,

> I seem to have missed the bus last night :(  I'll try again.
>
> I have a hand-coded composite widget which uses a  
> Gtk.Window.Gtk_Window_Record as a Top Level Widget.
>
> When I click on the
> +-+
> |X|
> +-+ button at top right of the window the widget disappears but the  
> program is still running.
>
> How kill the program as well with the button-click?

In Gtk, the main loop is not tied to one particular main window, so  
when you destroy a window, the main loop still runs. If you want to  
quit the main loop when the window is destroyed, connect to the  
"destroy" event on the window and, in the callback, quit the main loop  
by calling, for instance, Gtk.Main.Main_Quit.

Note that GtkAda comes with an example program called "testgtk" which  
contains an example of how every widget is used. The above is also  
done in testgtk, so you can look at these sources for inspiration  
(hint: look for references to "Exit_Main" in the testgtk sources)

Nicolas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/gtkada/attachments/20090608/dacc5b6c/attachment.htm 


More information about the gtkada mailing list