Page 1 of 1

Event parameters

Posted: Tue May 03, 2016 1:51 pm
by soapagent
I have a list in which each row may contain up to three buttons. I need to know what was clicked to I've tried to add event parameters but this gives an error at runtime. This is my code (c is the button number).

#COM_OWNER.Set_Button Name(tabStudents + '.Row%' + #x.AsString + '.Status' + #c.AsString) Text(#NOMCDN) Color(white) Buttonfacecolor(#bossecgry) Onclick(SELNOM + #c.AsString)
#COM_OWNER.Set_EventParameter Event(tabStudents + '.Row%' + #x.AsString + '.Status' + #c.AsString + '.OnClicked') Param_N(1) Paramvalue(#NOMCDE)

Is this possible.

Re: Event parameters

Posted: Tue May 03, 2016 3:03 pm
by tsupartono
It may be better to use the CurrentOp.SenderID property to determine the button that was clicked.
This approach uses the row IDs to determine the row of the button, so you must assign an ID to each of the row.

Code: Select all

#COM_OWNER.Set Property('Row#1.FirstCol.Text') To('Button 1')
#COM_OWNER.Set Property('Row#1.ID') To('1')

#COM_OWNER.Set Property('Row#2.FirstCol.Text') To('Button 2')
#COM_OWNER.Set Property('Row#2.ID') To('2')

#COM_OWNER.Set Property('Row#3.FirstCol.Text') To('Button 3')
#COM_OWNER.Set Property('Row#3.ID') To('3')
Then you would use the CurrentOp.SenderID#1 and CurrentOp.SenderID#2 to determine which button was clicked.
In this case, SenderID#1 would give you the column name, and SenderID#2 would give you the Row ID.

Code: Select all

#COM_OWNER.Get Property('/CurrentOp.SenderID#1') Into(#ColumnName)
#COM_OWNER.Get Property('/CurrentOp.SenderID#2') Into(#RowID)
If you still want to use action parameter, you would need to create an explicit PerformAction operation like so:

Code: Select all

#COM_OWNER.Using Element('Row#1.FirstCol.OnClick.Operation')
#COM_OWNER.Set Property(Type) To(PerformAction)
#COM_OWNER.Set Property(Action) To(BUTTON_CLICK)
#COM_OWNER.Set Property('Param#1') To(Button1AsParam)
#COM_OWNER.EndUsing