Hey there,
I've got a couple of pull down menus -
I would like to set a default text that is not one of the menu items.
If the user selects a menu item, I would like to display that menu item in the label.
If the user clicks on the pull down menu, but doesnt end up selecting one of the menu items, I'd like the label of the menu to stay the default text.
For example -
COLORS
-Red
-Blue
-Yellow
The default text displayed on the pull down menu would be "COLORS"
If the user clicks the menu and selects an item (lets say Blue), I'd like to set the label of the pull down menu to "Blue"
if the user clicks the menu but doesnt select an item, I'd like to keep the text of "COLORS" upon exit.
Any thoughts?
Pull Down Menu - Default Text
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Pull Down Menu - Default Text
Hi.
These sorts of exercises are always fun, mainly because there are several ways to do them. Try this. Make a pulldown. In its script:
I tried to think of a way to keep it all in the "menuPick" handler without another message (mouseDown) being required, but could not, since no message at all (except mouseDown) is sent from a pulldown if the user clicks in it, and then releases the mouse within the button rect itself. This also makes the "previousTab" parameter useless. So it feels like a kluge, though it works fine.
Craig Newman
These sorts of exercises are always fun, mainly because there are several ways to do them. Try this. Make a pulldown. In its script:
Code: Select all
on menuPick pItemName
set the label of me to "Colors"
if pItemName <> the label of me then set the label of me to pItemName
end menuPick
on mouseDown
lock screen
set the label of me to "Colors"
end mouseDown
Craig Newman