There is a small banana skin with the Create method: when I try to 
extend Gnoga.Gui.View.Modal_Dialog.Dialog_Type for containing its own 
buttons and other elements, like this:

    type Custom_Modal_Type is new 
Gnoga.Gui.View.Modal_Dialog.Dialog_Type with record
       Hide_Dlg_Bttn  : Gnoga.Gui.Element.Common.Button_Type;
    end record;

changing the App_Data like this:

    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          : Custom_Modal_Type;
          Show_Dlg_Bttn  : Gnoga.Gui.Element.Common.Button_Type;
          --  Add other controls here
       end record;

(and the code around the inner button as following:
       App.Modal.Hide_Dlg_Bttn.Create (App.Modal, "Hide Dialog");
       App.Modal.Hide_Dlg_Bttn.On_Click_Handler 
(On_Hide_Dlg_Click'Unrestricted_Access);
)

then the Create method becomes ambiguous to GNAT (GPL 2016):

       App.Modal.Create (App.Main_Window.all);

modal.adb:69:16: ambiguous call to "Create"
modal.adb:69:16: possible interpretation (inherited) at line 17
modal.adb:69:16: possible interpretation (inherited) at line 17

My guess is that it hesitates between the Create in 
Gnoga.Gui.View.Modal_Dialog and the one in Gnoga.Gui.View.

My fix #1 is to rename Create as Create_Modal.
But I guess you want to prevent people using the Gnoga.Gui.View.Create 
for the modal dialogs.

So my fix #2 is to define this public,

    overriding
    procedure Create
       (View             : in out Dialog_Type;
        Parent           : in out Gnoga.Gui.Base.Base_Type'Class;
        ID               : in     String := "");

then in the body, convert to Window_Type when needed:
11:      Old_View : Gnoga.Gui.Base.Pointer_To_Base_Class := 
Gnoga.Gui.Window.Window_Type(Parent).Get_View;
18: Gnoga.Gui.Window.Window_Type(Parent).Set_View(Old_View.all);

Comments ? Better ideas ?
Cheers
Gautier



------------------------------------------------------------------------------
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