What is whichMenu?

Devin Asay devin_asay at byu.edu
Thu Mar 23 14:26:50 EST 2006

On Mar 23, 2006, at 10:15 AM, Dr. Robert E. Ball wrote:

> When using the browser pointer, I go to the menubar of my OS X  
> stack, click
> on a menu item, e.g. File, and then click on one of the dropdown  
> items in
> the menu, e.g. Save in the File menu. In the message watcher, I get
> MouseDown  -- I clicked on File
> cREVGetsUpdate
> MenuPick   -- I clicked on Save
> whichMenu
> when it works properly. However, on another stack it doesn't work.  
> I only
> get
> mouseDown
> cREVGetsUpdate
> menuPick
> No whichMenu. ???  I don't know where to look to find out where the  
> problem
> is located. I searched the PDF manual and Googoled whichMenu. No  
> luck. Does
> anyone know where whichMenu is described?

It looks like a passed parameter variable is showing up in the  
message watcher. When you write a menuPick handler you normally want  
to include a parameter variable after the handler name, like this:

on menuPick whichMenu
   switch whichMenu
     case "Open"
       # do open stuff
     case "Quit"
       # do quit stuff
   end switch
end menuPick

The parameter variable holds the name of the menu item that was  
chosen. It can be any valid variable name, but many rev programmers  
use the convention in which parameter variables begin with p, eg.  
pWhich or pTheThingTheyChoseOnTheMenu. You really need to capture  
this passed argument in order to make the menu behave the way you  
want. If it's not captured in a variable then the menuPick handler  
likely will not work.



Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

More information about the Use-livecode mailing list