It looks very good. I'll test it with input boxes and so on...
For making the testing easy for others, I've put a few lines around your 
test code so they can just compile it "out of the box" - just add 
"modal.adb" in test.gpr.
Gautier
________________________________________________
Your daily dose of buzzwords: http://cbsg.sf.net

---

with Gnoga.Application.Multi_Connect;
with Gnoga.Gui.Window;
with Gnoga.Gui.Base;
with Gnoga.Gui.Element;
with Gnoga.Gui.Element.Common;
with Gnoga.Types;

with Gnoga.Gui.View.Modal_Dialog;

procedure Modal is
    use Gnoga;
    use Gnoga.Types;
    use Gnoga.Gui;
    use Gnoga.Gui.Element;

    type App_Data (Main_Window : access 
Gnoga.Gui.Window.Window_Type'Class) is
       new Gnoga.Types.Connection_Data_Type
    with
       record
          Top_Level_View : Gnoga.Gui.View.View_Type;
          Modal          : Gnoga.Gui.View.Modal_Dialog.Dialog_Type;
          Show_Dlg_Bttn  : Gnoga.Gui.Element.Common.Button_Type;
          Hide_Dlg_Bttn  : Gnoga.Gui.Element.Common.Button_Type;
          --  Add other controls here
       end record;
    type App_Access is access all App_Data;

    procedure On_Show_Dlg_Click
       (Object : in out Gnoga.Gui.Base.Base_Type'Class)
    is
       App : constant App_Access := App_Access (Object.Connection_Data);
    begin
       App.Modal.Show;
    end On_Show_Dlg_Click;

    procedure On_Hide_Dlg_Click
       (Object : in out Gnoga.Gui.Base.Base_Type'Class)
    is
       App : constant App_Access := App_Access (Object.Connection_Data);
    begin
       App.Modal.Show (False);
    end On_Hide_Dlg_Click;

    --  This procedure is called each time a connection is made.
    procedure On_Connect
       (Main_Window : in out Gnoga.Gui.Window.Window_Type'Class;
        Connection  : access
           Gnoga.Application.Multi_Connect.Connection_Holder_Type)
    is
    pragma Unreferenced (Connection);
       --  This is deallocated when the connection closes
       App : constant App_Access := new App_Data 
(Main_Window'Unchecked_Access);
    begin
       --  Associate App with this connection
       App.Main_Window.Connection_Data (App);

       --  Initialize Application Layout
       App.Top_Level_View.Create (Main_Window);
       App.Top_Level_View.Hidden;  -- Hide initially until done
       App.Top_Level_View.Put_Line ("Hello World");
       App.Show_Dlg_Bttn.Create (App.Top_Level_View, "Show Dialog");
       App.Show_Dlg_Bttn.On_Click_Handler 
(On_Show_Dlg_Click'Unrestricted_Access);

       --  Configure your Modal Dialog here
       App.Modal.Create (App.Main_Window.all);
       App.Modal.Put_Line ("Modal Dialog");
       App.Hide_Dlg_Bttn.Create (App.Modal, "Hide Dialog");
       App.Hide_Dlg_Bttn.On_Click_Handler 
(On_Hide_Dlg_Click'Unrestricted_Access);

      --  Show Page
       App.Top_Level_View.Hidden (False);

       --  Do something

    end On_Connect;

begin
    Application.Multi_Connect.Initialize (Boot  => "debug.html");

    Application.Multi_Connect.On_Connect_Handler
      (On_Connect'Unrestricted_Access, "default");
    Application.Open_URL;

    Application.Title ("Test App for Gnoga");
    Application.HTML_On_Close
      ("<b>Connection to Application has been terminated</b>");

    Application.Multi_Connect.Message_Loop;
end Modal;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to