Trying to make Outlook-like buttons

Jeanne A. E. DeVoto jeanne at
Tue Oct 8 13:34:01 EDT 2002

At 5:28 AM -0700 10/8/2002, Jan Schenkel wrote:
>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

Jeanne A. E. DeVoto ~ jeanne at
Runtime Revolution Limited - The Solution for Software Development

More information about the Use-livecode mailing list