Menu Buttons

Jim Ault jimaultwins at yahoo.com
Tue May 10 13:16:54 EDT 2011


On May 10, 2011, at 9:43 AM, Pete wrote:

> I might be wrong but I think the send commands, as you listed them,  
> aren't
> correct - I believe the message and it's parameters have to be one  
> string.
> So something like:
>
> send "menuPick aspirin" to button "Examples"
>
> or
>
> send "menuPick" && (line 3 of btn "Examples") to btn "Examples"


Pete, you are probably correct 'most of the time' and the reason is  
that most of the time the interpreter will use what it thinks you mean  
when it finds ambiguous syntax, and get it right.

What this means is that to the interpreter...

send menuPick && (line 3 of btn "Examples") to btn "Examples"

could mean menuPick as a reserved word
could mean menuPick as a variable
or
could mean "menuPick" as a string

Hopefully you can see that you are leaving it up to the interpreter to  
know which you intend.

send desiredKeyword  && paramVariable to btn "Examples"
-- can vary depending on what the interpreter sees as
--  desiredKeyword > {literal string, variable, reserved word}

If it is seen as a reserved word, then it probably evaluates as an  
empty string.
step 2  If it is seen as a variable container, then it evaluates the  
value of that variable.
and step 3 in the decision tree is to assume it is a literal string.

To be consistent and reliable, a programmer should always insure a  
literal string is used and arrives as the exact equivalent desired,  
including spaces and commas.
>
Hope this helps.

Jim Ault
Las Vegas






More information about the use-livecode mailing list