iOSToolbar - which button was pressed?

Hi,

If I give an iOSToolbar button a plain text caption, I can easily tell which button was clicked by saying:

if button.caption = "Play" then
   MessageBox("The music will now start to play!")
end if

However, if I replace the caption with a play icon, it no longer recognizes that the “Play” button was pressed. If it was only one button, I wouldn’t need to worry about this, but I plan on having multiple buttons in the toolbar, so I need to know how to distinguish them apart. Any ideas or suggestions?

Thank you!

I found the answer! I am sharing it here for anyone else who might find this helpful:

I have a button called (btn_play).

if button = btn_play then
MessageBox("The music will now start to play!")
end if

Hope this helps!

If you are adding the button by code you can also assign a value to the tag property and use that tag in the event.

1 Like