Trying to make Outlook-like buttons

Jan Schenkel janschenkel at
Tue Oct 8 13:51:01 EDT 2002

--- "Jeanne A. E. DeVoto" <jeanne at> wrote:
> 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

Thanks Jeanne,

On the way home I had just come up with an alternative
method ; if you make the whole button a cascade menu,
and set its script to

-- Start of script
on mouseDown
  put the seconds + (the uPopupDelay of me) into \
  wait until (the mouse is "up") or (the seconds > \
  if the seconds < tPopupTime then
    send "mouseQuickUp" to me
  else pass mouseDown
end mouseDown

on mouseQuickUp
  -- the default choice
  answer "This worked !"
end mouseQuickUp
-- End of script

And this worked as well ;  but no matter how hard I
tried (using flushEvents(all) even) it would still
briefly display the menu after the mouseQuickUp was

But by applying the 'popup' command, things should
work fine. Thanks again,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish
at the same time."  (La Rochefoucauld)

Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More

More information about the use-livecode mailing list