Thanks all for your answers, It was indeed an issue about missing pointeur towards father Grid object. Grid.Create creates a new view for each cell of the grid which is linked to the grid with: Column_Object.Attach_Using_Parent (Grid, CID & "_" & Left_Trim (N'Img)); Although Gnoga ID are so well linked in Attach_Using_Parent, nothing is done about Parent_Object pointer. So just after, I add : Column_Object.Parent (Grid); And now all is fine: 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.Parent); begin View.Label_Text.Put_Line ("Click"); end On_Click;
This is just a patch in Grid.Create, should I put the modification directly in Attach_Using_Parent? David, can you confirm? NB: I've updated typo ticket (https://sourceforge.net/p/gnoga/tickets/16/) about event_listeners.txt name typo. It's an ongoing ticket where anyone can append typo. Thanks, Season's Greetings, Pascal. http://blady.pagesperso-orange.fr > Le 24 déc. 2017 à 03:42, Jeremiah Breeden <jeremiah.bree...@gmail.com> a > écrit : > > Jeffrey's solution is probably the cleanest. Some alternates: > > Rosen Technique: > Change your declaration to: > > ***************************************************************** > type Default_View_Type; > > type Button_With_Parent(Parent : not null access Default_View_Type) > is new Gnoga.Gui.Element.Common.Button_Type with null record; > > type Default_View_Type is new Gnoga.Gui.View.Grid.Grid_View_Type with > record > Label_Text : Gnoga.Gui.View.View_Type; > Click_Button : Button_With_Parent(Default_View_Type'Access); > end record; > ***************************************************************** > > And then your click handler to: > > ***************************************************************** > procedure On_Click (Object : in out Gnoga.Gui.Base.Base_Type'Class) is > Button : Button_With_Parent renames Button_With_Parent(Object); > View : Default_View_Type renames Button.Parent.all; > begin > View.Label_Text.Put_Line ("Click"); > end On_Click; > ***************************************************************** > > another option is an event listener paradigm, but it is probably too complex > for > something like this. There is a write up at: > https://sourceforge.net/p/gnoga/code/ci/dev_1.3/tree/docs/articles/event_listeners.txt > > NOTE: noticed that my last name was incorrectly spelled. It is Breeden. > > This method involves making the button an event generator and the view a > listener. It's not very > clean though. Jeff's solution seems like the best to me. > > On Fri, Dec 22, 2017 at 5:29 AM, Pascal via Gnoga-list > <gnoga-list@lists.sourceforge.net> wrote: > Hello, > > 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? > > Thanks for help, Pascal. > http://blady.pagesperso-orange.fr ------------------------------------------------------------------------------ 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