Send Menupick?

J. Landman Gay jacque at hyperactivesw.com
Mon Jan 23 14:20:11 EST 2006


Sivakatirswami wrote:

> but I get an error for this line:
> 
>  send menupick ("Working Guide") to btn "Help"
> 
> and the script error is saying it thinks this is a function call and  
> not an attempt to send a msg?

Yes, because it is written like a function call using parentheses:

  menupick("Working Guide")

You need a command statement:

  put "Working Guide" into tItem
  send "menupick tItem" to btn "help"

And as Klaus notes, use quotes around the statement to send.

One other suggestion: Whenever I have a situation like this where I need 
to call menu items from other handlers, I never put the command 
statements into the menu button itself. Rather, I write a handler 
containing the instructions and then call that handler from both the 
menu button and the other places in my scripts. It saves a lot of 
debugging, not to mention avoiding the overhead for "send" statements. 
In this case, I'd put this into your Help button:

case "Working Guide"
   showWorkingGuide
   break
...
end switch

And then put a "showWorkingGuide" handler in the stack script which 
could be called from anywhere else.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list