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

Re: Cannot use a menu

Post by dunbarx » Mon Apr 21, 2025 4:25 pm

Richmond.
Fixing without understanding is an extremely short-term way of looking at things.
I agree. Any advice?

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 » Mon Apr 21, 2025 5:30 pm

Sure, go ahead and post it. Maybe a third person viewpoint will find something.
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 6:25 pm

OK.

This is a stack I wrote a decade ago as a Scrabble aid. It tracks tiles as they are used, keeps score, maintains a timer and a few other things. I run it in the IDE, but it can easily be turned into a standalone.

One uses the single menu "Gadgets" to add players' names and start a new game. There is a "Notes" menuItem that opens a guide and other features. But though the "Gadgets" menu will pull down normally and one may select any menuItem, it will not, as expected, send a "menuPick" message to the button handler. It used to until a couple of weeks ago.

This:

Code: Select all

send "menuPick" && "New players" to btn "gadgets"
(or any other menuItem) works fine, so I know the handler itself is OK.

What all of a sudden prevents the pulldown menu, which appears to work properly, from sending that message? One can edit the script of button "Gadgets" at any time.

TileTracker5.livecode.zip
(14.43 KiB) Downloaded 109 times
Craig

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 132
Joined: Sun Feb 20, 2011 4:26 pm
Contact:

Re: Cannot use a menu

Post by PBH » Tue Apr 22, 2025 6:56 pm

Fixed in a couple of minutes…

To track the problem in this stack I activated the Message Watcher.

The Message Watcher indicated the Mouse Down message was being intercepted by the Card Script line 43

I changed the handler from 'on mousedown' to 'after mousedown' and the menu subsequently worked!

Alternatively, you could change line 46 of the Card Script to end with 'then pass mouseDown'

Having said that, I have no idea what changed from the earlier version, did you add the mouseDown handler to the card? I think that would have been obvious to you, so I doubt that is the case, so I can only imagine that it must be something else that changed the message path.

Paul

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 » Tue Apr 22, 2025 7:29 pm

Paul.

Well, well. Thank you. You nailed it.

My failing was that I did not consider that when one clicks on a menu-style button, a "mouseDown" message is sent before a "menuPick" message. And the mouseDown handler in the card script exits if the target is not one of two particular fields. The button is, er, not one of those two fields. And this was a modification I added while installing a new feature to the stack.

Dangerous business, that, obviously. Anyway, at least I had a backup

Again, thanks, mystery solved, and I learned I have to be a better detective.

Craig

EDIT, assuming I get that new feature installed without crashing my computer, anyone who plays Scrabble is welcome to have that stack. it mostly works. :wink: If even one person asks, I will post the new working stack.

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 132
Joined: Sun Feb 20, 2011 4:26 pm
Contact:

Re: Cannot use a menu

Post by PBH » Tue Apr 22, 2025 7:39 pm

Pleased to help, sometimes all it takes is a fresh pair of eyes, I think we've all been there!

The Message Watcher is frustrating at times, but it usually gets me out of bother when I mess up. :)

Paul

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 » Tue Apr 22, 2025 8:22 pm

Paul.

Yep, and the issue is usually an unwanted flood of messages that one does not need. Filtering helps, but can be too much work to get just right. This:
viewtopic.php?f=6&t=35496&p=202659&hili ... er#p202659
Was an old thread, and the upshot was we need, not better message suppression, but an "Allow only" list. That is usually what I need when tracing a problem.

Of course, that would not have helped me in my most recent problem :wink:

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 » Tue Apr 22, 2025 9:11 pm

The most annoying thing about computers is that they always do exactly what you tell them to. :|
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 » Tue Apr 22, 2025 10:38 pm

Jacque.

I don't get it. I don't listen to anything I say to myself.

Craig

Post Reply