Page 1 of 1
Identify button
Posted: Thu Nov 03, 2022 2:10 pm
by codes4kids
Is it possible to identify a button ID by the icon image ID? Thanks!
Re: Identify button
Posted: Thu Nov 03, 2022 2:17 pm
by dunbarx
Hi.
If I understand what you are asking, the "icon" is a property of a button. So if you had, say, ten buttons, and the icon of one of them was, say, "210012", then this would pick it out:
Code: Select all
on mouseUp
repeat with y = 1 to the number of buttons
if the icon of button y = 210012 then
answer the ID of btn y
exit repeat
end repeat
end mouseUp
Craig
EDIT: I beat Klaus to virtually the same handler by two minutes.
HAH!
Anyway, he actually answered the OP's question just a tad better, so I updated my original handler by answering the ID instead of the number.
Re: Identify button
Posted: Thu Nov 03, 2022 2:19 pm
by Klaus
Sure, with a repeat loop over all the buttons on the current card, see example (or the complete stack if neccessary)
Code: Select all
...
repeat with i = 1 to the num of btns
if the ICON of btn i = your_wanted_id_here then
anwser the ID of btn i
end if
end repeat
...
Re: Identify button
Posted: Sun Nov 06, 2022 1:46 pm
by codes4kids
Thank you dunbarx and Klaus!