comp.lang.ada
 help / color / mirror / Atom feed
From: David Botton <david@botton.com>
Subject: Re: Launching Popup Windows in Gnoga
Date: Mon, 20 Oct 2014 15:30:10 -0700 (PDT)
Date: 2014-10-20T15:30:10-07:00	[thread overview]
Message-ID: <9ebb7994-aaf1-4eec-a335-bd72ff0acd6b@googlegroups.com> (raw)
In-Reply-To: <e61eac40-31ea-4bc1-96ee-1ed9d24c2d70@googlegroups.com>

>    procedure On_Main_Button_Click( Obj : in out Gnoga.Gui.Base.Base_Type'Class) is
>       Popup_Window : Gnoga.Gui.Window.Window_Type;
>    begin

Your issue is not with popups, but an Ada issue.

Popup_Window will finalize at the end of the procedure On_Main_Button_Click, even though the popup will remain on the screen, reference to it has disappeared both in Gnoga and on the browser.

Try this instead:

   procedure On_Main_Button_Click( Obj : in out Gnoga.Gui.Base.Base_Type'Class) is 
      Popup_Window : Gnoga.Gui.Window.Window_Access :=
         new Gnoga.Gui.Window.Window_Type; 
   begin 

That will create a dynamic object that will persist after the procedure terminates. However keep in mind that you now have a small memory leak if you never end up calling Popup_Window.Free.

For a short lived utility app that may be acceptable.

Another example:

   Popup_Window : Gnoga.Gui.Window.Window_Access := null;

   procedure On_Main_Button_Click( Obj : in out Gnoga.Gui.Base.Base_Type'Class) is 
   begin     
     if Popup_Window /= null then
       Popup_Window.Close;
       Popup_Window.Free;
     end if;
     Popup_Winow := new Gnoga.Gui.Window.Window_Type;
...

David Botton


  reply	other threads:[~2014-10-20 22:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 12:56 Launching Popup Windows in Gnoga Jeremiah
2014-10-20 13:38 ` David Botton
2014-10-20 15:22 ` David Botton
2014-10-20 22:01   ` Jeremiah
2014-10-20 22:30     ` David Botton [this message]
2014-10-20 23:07       ` Jeremiah
2014-10-21  0:21         ` David Botton
2014-10-21  0:27           ` David Botton
2014-10-21  1:27             ` David Botton
2014-10-21  2:06               ` jeremiah.breeden
2014-10-21 11:24               ` David Botton
2014-10-22  1:56                 ` Jeremiah
2014-10-22  2:09                   ` David Botton
2014-10-22  2:57                     ` Jeremiah
2014-10-22 15:24                       ` David Botton
2014-10-21  2:03           ` Jeremiah
replies disabled

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