[gtkada] Exceptions propegated to main program and GtkAda ?
Preben Randhol
randhol at pvv.org
Fri May 3 12:29:15 CEST 2002
Hi
Yesterday I added a exception dialog to my program
(http://www.pvv.org/~randhol/Ada95/Glosa/). The point was that I wanted
a dialog to pop up as an exception was caught in the main program so
that I could give instructions to the user on how and what to report.
The problem is of course that the program will exit and my dialog will
never be shown. I have a procedure like this:
procedure Error_Report (Error : String) is
Dialog : Common_Dialog.Advanced.Exceptions.Exceptions_Dialog_Access;
begin
Common_Dialog.Advanced.Exceptions.Gtk_New
(Dialog => Dialog,
Title => "An Exception Occured",
Message => "bla bla bla",
Bug_Message => Error);
Common_Dialog.Advanced.Exceptions.Show_All (Dialog);
-- And then it returns
end Error_Report;
Now I was thinking that I perhaps should add before the
"-- And then it returns" comment this:
while not Exceptions.User_Closed_Dialog loop
null;
end loop;
Where the User_Closed_Dialog will return True if the user clicks the
Close button (by setting a variable from the callback of the Close
button).
Or is there a better way?
Main program code below:
-- [snipped the with-uses]
procedure Glosa is
begin
Gtk.Main.Set_Locale;
Gtk.Main.Init;
Gtk.Rc.Init;
Window.Make;
Welcome.Show;
Show_All (Window.Get_Gui);
Settings.Gui.Init;
Gtk.Main.Main;
exception
when E : others =>
Put_Line (Exception_Information (E));
-- Calling my function that creates and Shows a modal dialog
Exceptions.Error_Report (Error => Exception_Information (E));
end Glosa;
More information about the gtkada
mailing list