Why doesn't menupick work

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Aug 21 07:54:08 EDT 2014


Hi,

"card" is part of the name, but not of the short name. A correct card 
reference is

card "The short name"

This would be the complete name of the card and you can use it directly 
in a script:

go card "The short name"
put (there is a card "The short name")

There are a few things I would not do:
1) starting card names with numbers
2) starting card names with spaces
3) including any special characters such as "/" or "#" or non-printable 
characters in card names
4) starting the short name of a card with "card"

References such as

go card "1"
go cd "1 "
go card "card 1 bla"

would be either incorrect or a source of confusion.

Depending on which version you're using, the combobox might be returning 
unicode. I don't really expect his, but it is easy to check, using the 
lenght function:

on menuPick theItem
   put len(theItem)
end menuPick

and see if the number is what you expect.

Did you make the list of cards in the combobox manually? Perhaps you can 
use this syntax:

put the cardNames of this stack into btn "Your Combobox"


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 8/21/2014 13:02, revolution at duncansoftware.on-rev.com wrote:
> On 8/20/2014, 8:08 PM, revolution at duncansoftware.on-rev.com wrote:
>> Why doesn't  this code work?
>>
>> on menuPick pItemName
>>     go card pItemName
>> end menuPick
>>
>> where the comboBox has a list of card names.
>
>>> Set a breakpoint at the "go" line and when it pauses, see what's in
>>> pItemName and whether there's a card with that name. You can also
>>> temporarily add "answer the result" after the "go" statement; maybe
>>> there's a silent error happening.
>
> Thanks for everyone's suggestions but...
> I tried setting a breakpoint and pItemName contains the name of a card.
> However when I tried "answer the result" the response is
> "No such card".
> When I use the message box "Put the name of card 1" it reports
> card " 1 External  Dorsal ~"
> which seems to be saying that "card" is part of the name.
> I tried various methods of adding card to the pItemName such as
> put "card" && quote & pItemName & quote into pitemName
>
> go pItemName
>
> or
>
> go card card pItemName
>
> but these also failed and reported "No such card."
>
> The spaces and tilde in the card name is not the problem.
> There are 75+ cards and many do not have extra spaces and tildes.
>
> If I just type into the message box
> go card " 1 External  Dorsal ~" it goes to the card.
>
> MacBook Pro OSX 10.6.8 and any version of Livecode that I have tried 6.0 6.52 6.60.





More information about the use-livecode mailing list