[gtkada] Exceptions propegated to main program and GtkAda ?
Preben Randhol
randhol at pvv.org
Fri May 3 16:31:57 CEST 2002
manuel.op.de.coul at eon-benelux.com wrote on 03/05/2002 (15:57) :
> >Will this halt the execution of the rest of the Ada program until
> >Gtk.Main.Quit is called again?
>
> No, but you'd want this dialog to be modal, i.e. that the user
> can't use other dialogs.
Of course I want a modal dialog if the user has to deal with the
dialog before doing anything else. :-)
After testing; Gtk.Main.Main, if called again will halt the program
until Gtk.Main.Main_Quit is called.
>
> > I mean if you choose New or Open
> >or Exit and you haven't save, then I would like the user to first
> >tell me whether he wants to save or not.
>
> Yes you should use a modal dialog for this.
I do :-)
But I will switch to call Gtk.Main.Main in this dialog as I then don't
need this post action hack at all, because:
if not Settings.Is_Saved then
declare
Text : String := (-"There are unsaved changes. ") &
ASCII.LF &
(-"What do you want to do?");
begin
Window.Unsaved_Changes_Dialog (Text);
Put_Line ("Test");
end;
end if;
now the program will not print "Test" before the Unsaved_Changes_Dialog
has issued a Gtk.Main.Quit. And therefore I can put the actions I need
to go after this. If you don't use Gtk.Main.Main the program will print
"Test" right away after the Dialog is shown. So if you want to run a
procedure that removes all data from your program after the user has
been asked if he wants to save first you must have Gtk.Main.Main. If not
the data will be delete before he answers. :-)
--
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
«For me, Ada95 puts back the joy in programming.»
More information about the gtkada
mailing list