Determining which menu button was clicked on Mac

Mark Wieder mwieder at ahsoftware.net
Thu Jan 8 02:12:26 EST 2004


Trevor-

Hmmm. I think a more "standard" way of dealing with this is to have
both "Play" and "Pause" menuItems, one of which is grayed out at any
given time. This works for me in a menuPick handler - initially
"Pause" is disabled, then when the user selects "Play" the enabled and
disabled options are switched. I also think it gives the user more of
a sense of continuity than menu items that appear and disappear.

on menuPick chosenItem
  if isPlaying then
    if chosenItem is "Pause" then
      enable menuItem 2 of button "Menus" --"Play" menuItem
      disable menuItem 3 of button "Menus" --"Pause" menuItem
      put false into isPlaying
    end if
  else
    if chosenItem is "Play" then
      enable menuItem 3 of button "Menus" --"Pause" menuItem
      disable menuItem 2 of button "Menus" --"Play" menuItem
      put true into isPlaying
    end if
  end if
end menuPick

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list