How can I make a button do something when I click it one, then do something else when I click it again. Like show something, not show something?
Would this be better done with a checkbox? (I figured out the code to do it that way)
Thanks!
Click once do something, click again do something else?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
Odd as it sounds, a checkbox is (as far as RunRev is concerned) a button.
So the way to do it with a "normal" button is pretty similar. With a checkbox the hilited property is a handy built-in that can be used to give visible feedback of the state, and be checked for the condition to tell what to do whether true or false.
If you want to do this with a custom button you can do something like (and there are many ways to skin the RunRev cat):
(Untested - check for typos!)
HTH,
SparkOut
So the way to do it with a "normal" button is pretty similar. With a checkbox the hilited property is a handy built-in that can be used to give visible feedback of the state, and be checked for the condition to tell what to do whether true or false.
If you want to do this with a custom button you can do something like (and there are many ways to skin the RunRev cat):
Code: Select all
on mouseUp
set the uFlag of me to not the uFlag of me
-- toggles the custom property "uFlag" to be the opposite of the true or false condition it currently is
switch the uFlag of me
case true
--do stuff (maybe change the label of me, or visual appearance too)
break
case false
--do other stuff (maybe change the label of me, or visual appearance too)
break
end switch
end mouseUp
HTH,
SparkOut
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm