Page 1 of 1

Event from List RP

Posted: Fri Dec 02, 2016 12:01 pm
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?

Re: Event from List RP

Posted: Fri Dec 02, 2016 12:28 pm
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

Re: Event from List RP

Posted: Fri Dec 02, 2016 4:13 pm
by soa
Thank you. That worked and filled another little gap in my understanding (don't worry plenty left).

Re: Event from List RP

Posted: Fri Dec 02, 2016 6:36 pm
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!