I have 116 buttons in my stack all with same labels, but one (randomly choosed) has different label. What I want to do is when I click on a button it search all buttons in my card and changes the label of that one button (with different label) to same label all other buttons have.
I need some code LIKE this:
on mouseUp
if the label of *any* button is "Hide" then
set the label of *that button* to "Show"
else
end if
end mouseUp
Is this possible to do?
If any button...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: If any button...
Hi croivo,
no, that is not possible!
Just kidding
Sure it is, you will need to do a repeat loop like this:
Best
Klaus
no, that is not possible!

Just kidding

Sure it is, you will need to do a repeat loop like this:
Code: Select all
on mouseup
## Prevent any "flickering":
lock screen
## Loop over ALL buttons on current card:
repeat with i = 1 to the num of btns
if the label of btn i = "Hide" then
set the label of btn i to "Show"
end if
end repeat
unlock screen
end mouseup
Klaus
Re: If any button...
Thanks! That's what I was looking for...
Is there a way I can restrict the buttons for only certain group? For example, something like this:
Is there a way I can restrict the buttons for only certain group? For example, something like this:
Code: Select all
## Prevent any "flickering":
lock screen
## Loop over ALL buttons on current card:
repeat with i = 1 to the num of btns *of group "myGroupWithButtons"*
if the label of btn i = "Hide" then
set the label of btn i to "Show"
set the backgroundcolor of btn i to white
end if
end repeat
unlock screen
Re: If any button...
Hi croivo,
you almost had it
Klaus
you almost had it

Bestcroivo wrote:Code: Select all
## Prevent any "flickering": lock screen ## Loop over ALL buttons on current card ## Correct! repeat with i = 1 to the num of btns of group "myGroupWithButtons" ## but you need to add the exact "descriptor" every time: if the label of btn i of group "myGroupWithButtons" = "Hide" then set the label of btn i of group "myGroupWithButtons" to "Show" set the backgroundcolor of btn i of group "myGroupWithButtons" to white end if end repeat unlock screen
Klaus
Re: If any button...
That's it! Thanks Klaus!