Event from List RP

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Event from List RP

Post by soa »

I have a Form RP which contains a PRIM_LIST. In the PRIM_LIST one of the columns is a Prim_list.IListCellDesign RP. In the Cell I want to signal an event back back to the form but I don't know how to define the event in the Form RP as it would be coming from the PRIM_LIST but is not listed as an event on this object. Is this doable?
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Event from List RP

Post by Stewart Marshall »

You can only handle an event on an object to which you have a reference.

So, for list processing, the simple solution to this is to grab a reference to the object when focus changes

Add a define_Com for the class of the reusable part and set it when ever the list focus changes. You'll then have a reference to listen to events on.

Code: Select all

Define_Com Class(#MyReusablePart) Name(#CurrentPart) Reference(*Dynamic)

Evtroutine #List.ItemGotFocus
#CurrentPart <= #PartColumn.Currentitem.Part *as #MyReusablePart
Endroutine

Evtroutine #CurrentPart.Something

Endroutine
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Re: Event from List RP

Post by soa »

Thank you. That worked and filled another little gap in my understanding (don't worry plenty left).
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Event from List RP

Post by atostaine »

Stewart Marshall wrote:You can only handle an event on an object to which you have a reference.

So, for list processing, the simple solution to this is to grab a reference to the object when focus changes

Add a define_Com for the class of the reusable part and set it when ever the list focus changes. You'll then have a reference to listen to events on.

Code: Select all

Define_Com Class(#MyReusablePart) Name(#CurrentPart) Reference(*Dynamic)

Evtroutine #List.ItemGotFocus
#CurrentPart <= #PartColumn.Currentitem.Part *as #MyReusablePart
Endroutine

Evtroutine #CurrentPart.Something

Endroutine
wow. very cool. thanks!
Art Tostaine
Post Reply