menuPick pWhich go card...

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

menuPick pWhich go card...

Post by bogs »

This one has me stumped, really because I've used it about a hundred times before and (apparently) am having a complete duh moment now.

I loaded all the cards of a stack into a menu button, that worked fine -
Locked and loaded...
Locked and loaded...
Selection_001.png (40.18 KiB) Viewed 6765 times
for the menuPick handler, I simply put

Code: Select all

on menuPick pWhich
   -- put menuItem pWhich
   go to card pWhich of stack "LcTips" 
end menuPick
However, when I click on the menu and select an item, the item shows correctly in debugger for pWhich, but the stack doesn't move to the card.

I have tried so far :
putting pWhich in ( )
putting 'quote & pWhich & quote' (Was thinking of something Klaus told me before)

Code: Select all

   if (quote & pWhich & quote) is among the lines of the cardNames of stack "LcTips" then
      go to card (quote & pWhich & quote) of stack "LcTips" // "revLcTips"
   end if // skips straight to end if
...and many other variations, such as putting pWhich into a variable with and without quotes, but have come up empty every time, no moving to the card, no cookie for me :|

If I copy the text from pWhich, though, and put it into this command in the message box -

Code: Select all

put the number of card "Contextual menus" of stack "LcTips"
I get the number of the card as shown here -
Hmmmmmmm.......
Hmmmmmmm.......
Any idea on what I am missing? I am sure it is something stupid and simple, but I just am not seeing it.
Image
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: menuPick pWhich go card...

Post by Klaus »

Do your menu items really have QUOTES around them:
"Confused by a new term?"
"Contextual menus"
"Nudge controls"
etc...
? :shock:
If yes, remove them and try again.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: menuPick pWhich go card...

Post by Klaus »

Just made a little test with LC 9.03.
Created a stack with 3 cards: eins, zwei, drei (german for one, two, three)
Created a pulldown menu button:

Code: Select all

on mouseenter
   put the cardnames of this stack into me
end mouseenter

on menuPick pWhich
   go card pWhich 
end menuPick
Works as exspected.

Then I commented out the mouseenter handler and added QUOTES to the menu items manually:
"ein"
"zwei"
"drei"
NOW the "mouseup" handler oesd nothing, but also did not throw an error!?
Very funky...
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: menuPick pWhich go card...

Post by bogs »

:oops:
Like I said, simple and stupid. What a smultz I am
:oops:

Thank you Klaus :mrgreen:

When I put the menuItems in, I did it from the message box, and didn't even think of the quotes in the text of the button, just never made the connection.

Your right, there is no error, it just skips right over it in the debugger.
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: menuPick pWhich go card...

Post by dunbarx »

Bogs.

Where are these "tips"? And where is there a gadget to do what #23 says?

Craig
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: menuPick pWhich go card...

Post by bogs »

The tips stack came from vers. 2.x of Lc, then RunRev. I separated it out, and made it a plugin that should be independent of the IDE as much as possible. Right now, it is in this thread, but when it is finalized I'll be putting it on the share site.

I think you might need to read 23 again :wink:
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: menuPick pWhich go card...

Post by dunbarx »

Bogs.

Not getting anything, no matter how many times I read it. I cannot find the "reshape Polygon" tool, certainly not in the tools palette, and the optionKey does not act the way the tip says.

Craig
Last edited by dunbarx on Sun Apr 28, 2019 7:43 pm, edited 1 time in total.
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: menuPick pWhich go card...

Post by bogs »

My bad Craig, although the tool is no longer in the IDE, I thought the key-combo still worked. I'll have to correct that in the tips <sigh>.

*IF* you still have a copy of rev 2.x, you can find the tool in the tools palette, see below ~
My, what a lovely (re)shape you have...
My, what a lovely (re)shape you have...
The handlers look pretty legible, so I don't think it would be terribly difficult to reproduce. Not sure why it was removed, it works pretty well.
Image
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: menuPick pWhich go card...

Post by bogs »

Turns out I was wrong twice Craig :oops: I think I am setting a new record!
They MOVED it!
They MOVED it!
TWICE!!
TWICE!!
Image
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: menuPick pWhich go card...

Post by jacque »

Your right, there is no error, it just skips right over it in the debugger.
Probably because the quoted items are treated as plain strings where the first and last characters happen to be quotation marks. Those strings don't match anything in the menu script so nothing happens. It's not an error, just a mismatch.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: menuPick pWhich go card...

Post by bogs »

I think your right, and it sure sounds better than anything I came up with :D
Image
Post Reply