comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Re: Closing a program with GTK
Date: Thu, 22 Sep 2011 12:24:03 +0200
Date: 2011-09-22T12:24:03+02:00	[thread overview]
Message-ID: <4e7b0d07$0$2638$703f8584@news.kpn.nl> (raw)
In-Reply-To: <ec116uy7j718$.1urzzp7i6tpth$.dlg@40tude.net>

I just have corrected the problem for  the quit menu button, and that 
worked. Thanks for that. But the problem with the Close button on top of the 
window stays

The code of the procedures is now
procedure On_Quit1_Activate
  (Object : access Gtk_Image_Menu_Item_Record'Class)
is
   pragma Unreferenced (Object);
begin
   On_Window_Destroy(Transc_AdaWindow);
end On_Quit1_Activate;
and
procedure On_Window_Destroy
  (Object : access Gtk_Widget_Record'Class)
is
   pragma Unreferenced (Object);
begin
   Close_Ini;
   Gtk.Main.Main_Quit;
end On_Window_Destroy;

In the package where I am initiating the handlers I  have the following 
lines

package Destroy_Callback is new Gtk.Handlers.Callback (Gtk_Widget_Record);
--------------------------------------------------------------------------------
-- Creation Destroy action
--------------------------------------------------------------------------------
   Destroy_Callback.Connect( Transc_Ada, "destroy",
         Destroy_Callback.To_Marshaller (On_Window_Destroy'Access), False);

I expected the close button to got to the On_Window_Destroy routine but 
instead it goes to the gtk.object.Destroy routine

I can see in the GPS debugger the exact position where it goes wrong by 
placing a breakpoint in that Destroy routine.


"Dmitry A. Kazakov"  schreef in bericht 
news:ec116uy7j718$.1urzzp7i6tpth$.dlg@40tude.net...

On Thu, 22 Sep 2011 03:21:00 +0200, ldries46 wrote:

See:

http://rosettacode.org/wiki/Simple_windowed_application#Ada

for proper handling of application exiting. In particular,
Gtk.Main.Main_Quit must be called from Destroy handler. Delete event
handler must return False.

> When debugging in GPS I found that the message is generated in the
> gtk_object package in the Destroy routine at the moment that you enter the
> Internal routine with the Step button

You cannot debug Gtk applications in the debugger. Use tracing and error
Glib logging.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de 




  reply	other threads:[~2011-09-22 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-22  1:21 Closing a program with GTK ldries46
2011-09-22  7:20 ` Dmitry A. Kazakov
2011-09-22 10:24   ` ldries46 [this message]
2011-09-22 12:07     ` Dmitry A. Kazakov
2011-09-22 12:36       ` ldries46
2011-09-22 13:48         ` Dmitry A. Kazakov
2012-07-26 21:59           ` Jack Mitchell
2011-09-22 23:06         ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox