Using MouseUp Instead Of MenuPick
Mac OS 9 Mac OS X Windows Linux

> I can set the label of a popup, but the only way to get the label item
> to appear under the mouse is by calling menuHistory.
> Is there any way to call menuHistory without it calling menuPick? Or
> do I have to set a flag so that my menuPick routines ignore calls made
> via menuHistory?

When I want to be able to do this, I use a mouseUp handler in the menu button instead of a menuPick. It has to get the selectedText instead of having it as a parameter, but apart from that it works identically but doesn't get triggered when you set the menuHistory.


on menuPick pChoice
  answer "The selection was:" && pChoice
end menuPick

on mouseUp
  put the selectedText of me into pChoice
  answer "The selection was:" && pChoice
end menuPick
Suppose this is an option button and it contains the values "Apple","Orange", and "Lemon". If you then want to initialize the menu to show "Orange" on the button and set it so that "Orange" appears under the mouse when you pop it up, you would do:
set the menuHistory of btn 1 to 2
If the button contained the menuPick handler, you'd get the answer dialog appearing after it set the button. However if the button contained only the mouseUp handler, no dialog would be displayed.

Posted on 11/30/2004 by Sarah Reichelt to the Use Revolution list
Expanded on 2/10/2006 by Ken Ray