Making "Outlook-Style" Buttons
Mac OS 9 Mac OS X Windows Linux

>I've been trying to make Outlook-like buttons, where
>clicking on a button makes it do its default action,
>but holding the mouse down displays a popup-menu to
>choose from pre-defined actions.
>Unfortunately, none of my attempts (on MacOS) seem to
>work, as all menu-buttons display the menu right away,
>and there's no way of setting up a delay there.

Here's a method. It requires you create a separate popup menu button, which may be hidden:
local isInMenu -- keeps mouseUp from firing if you showed the menu

on mouseDown
  put false into isInMenu
  send "popGoesTheMenu" to me in 2 seconds -- delay time
end mouseDown

on mouseUp
  if isInMenu then pass mouseUp
  beep 2 -- or do whatever action you want for a click
end mouseUp

on popGoesTheMenu
  if the mouse is up then exit popGoesTheMenu
  put true into isInMenu
  popup button "My Popup"
  -- the menuPick handler in "My Popup" handles the actions
end popGoesTheMenu
Posted 10/8/2002 by Jeanne DeVoto to the Use-Revolution List