[gtkada] File refuses to be deleted on Win95

Joel Brobecker brobecker at act-europe.fr
Sun Dec 31 14:41:05 CET 2000


> When trying to delete the executable file of simple.adb (a very simple
> example that comes with GtkAda), I got the following error message:
> 
> Cannot delete simple: The specified file is being used by Windows

I suspect that you closed the window using the decorations (I know, you
have no other choice, given the simplicity of the program). Since the
application is not connected to the "destroy" event, the program remains
stuck in the Gtk main loop, although the main window is destroyed.

To correct this, do the following:

  - instantiate the Callback package
|  package Window_Cb is new Gtk.Handlers.Callback (Gtk_Widget_Record);

- create an Exit_Main procedure that leaves the main loop:

|  procedure Exit_Main (Object : access Gtk_Widget_Record'Class) is
|  begin
|     Gtk.Main.Main_Quit;
|  end Exit_Main;


- attach this procedure to the "destroy" signal before showing the window,
  or at least entering the main loop:

|  Window_Cb.Connect (Window, "destroy",
|                     Window_Cb.To_Marshaller (Exit_Main'Access))

Remember that callback packages must be instantiated at library level,
so in this example, you'll have to create a separate package (simple is
just a procedure).

Cheers,
-- 
Joel




More information about the gtkada mailing list