On 12/22/2017 11:29 AM, Pascal via Gnoga-list wrote:
> 
> After declaration of my view:
>    type Default_View_Type is new Gnoga.Gui.View.Grid.Grid_View_Type with 
> record
>       Label_Text   : Gnoga.Gui.View.View_Type;
>       Click_Button : Gnoga.Gui.Element.Common.Button_Type;
>    end record;
> 
> and creation of my objects:
>       Gnoga.Gui.View.Grid.Grid_View_Type (Grid).Create  (Parent, Layout, 
> Fill_Parent, Set_Sizes, ID);
>       Grid.Label_Text.Create (Grid.Panel (1, 1).all);
>       Grid.Click_Button.Create (Grid.Panel (1, 2).all, "Click Me");
> 
> My button controller is:
>    procedure On_Click (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
> --        View : Logo.View.Default_View_Access :=
> --          Logo.View.Default_View_Access (Object.Parent);
>    begin
>       --        View.Label_Text.Put_Line ("Click");
>       gnoga.log(ada.Tags.Expanded_Name(Object.Parent'tag));
>    end On_Click;
> 
> I've got a CE:
> raised CONSTRAINT_ERROR : logo-controller.adb:14 tag check failed
> 
> because of object parent's type:
> GNOGA.GUI.VIEW.VIEW_BASE_TYPE
> 
> How to get the true parent that is Default_View_Type and then access to 
> Label_Text?

There's an old joke that goes: A man went to the doctor and flexed his arm at
the elbow, saying, "Doctor, it hurts when I do this."

To which the doctor replied, "Then don't do that!"

There's a new non-joke that starts: A programmer went to the S/W engineer and
said, "It hurts when I use type extension."

   Grid         : Gnoga.Gui.View.Grid.Grid_View_Type;
   Label_Text   : Gnoga.Gui.View.View_Type;
   Click_Button : Gnoga.Gui.Element.Common.Button_Type;

   procedure On_Click (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
   begin
      Label_Text.Put_Line ("Click");
   end On_Click;

   Grid.Create (Parent, Layout, Fill_Parent, Set_Sizes, ID);
   Label_Text.Create (Grid.Panel (1, 1).all);
   Click_Button.Create (Grid.Panel (1, 2).all, "Click Me");
   Click_Button.On_Click_Handler (Handler => On_Click'access);

Simple, clear, and doesn't hurt.

-- 
Jeff Carter
"Sons of a silly person."
Monty Python & the Holy Grail
02

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