Cannot use a menu

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Cannot use a menu

Post by dunbarx » Thu Apr 17, 2025 4:27 am

I long ago made a Scrabble scorekeeper/tile tracker/timer. Useful if you are into that game.

Used in the IDE, it has a single custom Menu (a grouped button, of course) containing a menuPick handler with a switch statement that deals with a handful of options.

All of a sudden, although the menu works, in the sense that the menuItems it contains do indeed drop down, no menuPick message is sent upon selecting a subMenu. I can, from msg, send a menuPick message along with a parameter to the button itself, and that works just fine. But something has blocked any message from originating from the menu selection process itself.

I have to admit I was fooling around with the stack when I noticed the issue. What is blocking, intercepting, whatever, to the process of selecting a menuItem from that button? In other words, what did I do?

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Cannot use a menu

Post by richmond62 » Thu Apr 17, 2025 6:04 am

Well, you could post the menu code here.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Cannot use a menu

Post by Klaus » Thu Apr 17, 2025 11:47 am

You are CURSED, Craig, get used to it! :D :D :D

paul@researchware.com
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Wed Aug 26, 2009 7:42 pm
Contact:

Re: Cannot use a menu

Post by paul@researchware.com » Thu Apr 17, 2025 2:28 pm

Check the layering of the objects in the group (you said you had a grouped button). Im may be possible the layering got messed up and the menuPick is being sent to an object in the group other than the one with the script in it.

Just a suggestion.
Paul Dupuis
Researchware, Inc.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Cannot use a menu

Post by dunbarx » Thu Apr 17, 2025 4:13 pm

Thanks for the replies.

@ Richmond. The code itself is not the issue. I can manually send a "menuPick"message to the menu button and it works fine. I just can no longer invoke that message in the usual way.

@Klaus. Finally someone understands.

@Paul. Good point, which I tested yesterday by searching for all "menuPick" handlers in the stack. There is only one, the one in the menu button. The parent group containing that button has no handler.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Cannot use a menu

Post by richmond62 » Thu Apr 17, 2025 4:51 pm

Something else is trapping your mouse.
-
th.jpg

paul@researchware.com
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Wed Aug 26, 2009 7:42 pm
Contact:

Re: Cannot use a menu

Post by paul@researchware.com » Thu Apr 17, 2025 7:56 pm

Have you checked the menuMode property of the button to make sure it is set to a type that responds to the menuPick message?

Just another suggestion.

menuPick is likely not broken. Most likely there is some reason the menuPick message is not being delivered to the handler script. menuPick is only sent to button that have an applicable menuMode.
Paul Dupuis
Researchware, Inc.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Cannot use a menu

Post by dunbarx » Thu Apr 17, 2025 8:55 pm

Paul.

Great suggestion, but the menuMode of the menu button is "pullDown". :(

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Cannot use a menu

Post by jacque » Fri Apr 18, 2025 6:18 pm

Try a mouseDown or mouseUp handler in the button just to see if anything works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 161
Joined: Tue Feb 23, 2010 10:53 pm

Re: Cannot use a menu

Post by bobcole » Fri Apr 18, 2025 6:23 pm

Could it be that the button is grouped?
I don't know why that would make a difference.
Bob

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Cannot use a menu

Post by dunbarx » Sat Apr 19, 2025 8:16 pm

Jacque. Nothing. I even tried "mouseEnter", but the menu button is not really in the menuBar, no? So that makes no sense.

Bob. I think all such buttons, especially when built with the Menu Builder, are grouped. Mine is.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Cannot use a menu

Post by FourthWorld » Sun Apr 20, 2025 3:46 am

dunbarx wrote:
Thu Apr 17, 2025 4:13 pm
The code itself is not the issue.
But something is. If you can reproduce it in a stack that illustrates the issue, posting the stack will give us something to work with.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Cannot use a menu

Post by jacque » Sun Apr 20, 2025 5:52 pm

I assume this is on Mac? Is it possible that the menu group was duplicated and the wrong one is being used as a menu bar? Wild guess, I know.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Cannot use a menu

Post by dunbarx » Mon Apr 21, 2025 3:00 pm

@Richard. There always is, eh?

@ Jacque. On a Mac. Each stack has five groups, all identical. The menuButton has the same name and owner

I opened an older saved version of my stack, where all works just fine. With both stacks, I did the following:

1- Compared "the properties" of each stack, old and new. They are identical.
2- Each stack has five groups, one of which is the menuButton group. Same group name, same button name in each. Identical scripts in each.

Considering the above two items, I cannot understand why, even though the menu "action" works just fine, no "menuPick" is invoked in the newer stack. This is verified on two different machines.

I am happy to play with this as long as others are willing to, and happy to post my stack, especially if other Scrabble players are interested. I can fix my problem, yet again without understanding it, by simply going back to the old version and update it as per my original intent.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Cannot use a menu

Post by richmond62 » Mon Apr 21, 2025 3:55 pm

Fixing without understanding is an extremely short-term way of looking at things.

Post Reply