B4J Question Array of buttons

wheable

Member
Licensed User
I have an array of 24 buttons . If I give them identical event names in designer can I handle their click events in a single event handler . If so how do I pass the name of the button to this event handler so it can tell which button generated the event ?

Any help gratefully received
 

stevel05

Expert
Licensed User
You don't need to pass the name, the keyword Sender will point to the object (button) that raised the event so inside the click event:
B4X:
Dim B As Button = Sender
Log(B.Text)
Then B will point to the button that raised the event.
 
Last edited:

wheable

Member
Licensed User
You don't need to pass the name, the keyword Sender will point to the object (button) that raised the event so inside the click event:
B4X:
Dim B As Button = Sender
Log(B.Text)
Then B will point to the button that raised the event.
Thanks, Works perfectly. I'm setting the 'tag' property to uniquely identify the button.
 
Top