mouseDown cripples menuPick

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: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

mouseDown cripples menuPick

Post by dunbarx » Mon May 14, 2018 9:16 pm

Not sure if this is expected behavior. It made my life miserable for a bit.

On a new card place a pulldown menu button. In the button script:

Code: Select all

on menuPick pItemName
   set the label of me to pItemName
end menuPick
No problem, and the default three choices allows one to see the button in action.

Now, in the card script:

Code: Select all

on mouseDown
   exit to top
end mouseDown
Now the menu button does not work.

So one cannot trap "mouseDown" at the card level and expect a menu button script to fire, even though that script is local to the button . OK, I guess, as long as one knows about it. I had such a mouseDown handler that validated certain target controls, not allowing that message to pass through the ones of interest to me. It crippled new menu-style buttons.

Now I know.

Is this OK with everyone?

Craig

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

Re: mouseDown cripples menuPick

Post by bogs » Mon May 14, 2018 10:03 pm

Hm. I thought the way the message path worked, what your describing couldn't happen. Have I got the message path wrong again?
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: mouseDown cripples menuPick

Post by dunbarx » Mon May 14, 2018 11:46 pm

Bogs.

I don't think it can be so much a message path issue. The card is above (don't, Jacque) the controls it owns, and I just don't have the feeling that this is broken here.

I think, assuming it is not just an outrageous bug, that the "mouseDown" message is somehow internally intimately tied to the whole process of sending a "menuPick" message. That is, if one shuts off the first, so does one shut off the second.

Unless others think this is either old hat or an indispensable feature, I consider it a bug.

Craig

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Apr 13, 2006 6:25 pm

Re: mouseDown cripples menuPick

Post by rkriesel » Tue May 15, 2018 12:53 am

Code: Select all

on mouseDown
   exit to top
end mouseDown
Now the menu button does not work.
<snip>
Is this OK with everyone?
A system event handler that does not pass risks failure.

mouseDown would happen before menuPick. Why should something happen after exit to top?

-- Dick

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

Re: mouseDown cripples menuPick

Post by bogs » Tue May 15, 2018 1:55 pm

dunbarx wrote:
Mon May 14, 2018 11:46 pm
I don't think it can be so much a message path issue. The card is above (don't, Jacque) the controls it owns, and I just don't have the feeling that this is broken here.
Well, like I said, maybe I just (still) don't understand the whole path thingie :wink: but from your description, it sure sounds like a path thingie to me. Just for reference, the path as laid out in Lc's lessons.
Image
The problem your stating as my understanding of it goes in relation to the path :
  1. Button (object) on card gets input event to run menuPick script in button
  2. Card also has mouseDown script that exits, but is farther down the path
Now if you had said you had the exit mouseDown in the button, that would be one thing, but you don't. Since I assume your clicking on the button, and the menuPick script is in it, and the button is on the card, that in my understanding would get the priority in the path.

It would seem (to me) silly to require you to put in a mouseDown or mouseUp message to trigger the menuPick of a menu button, which is after all its primary function in life, in an object (card) farther down the message path.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: mouseDown cripples menuPick

Post by dunbarx » Tue May 15, 2018 2:10 pm

mouseDown would happen before menuPick. Why should something happen after exit to top?
You make a point here, and maybe it is pertinent.

But the menuPick handler lives in its own space in its own handler, and just because I exit the mouseDown handler all the way back to nothingness should not preclude another message from being sent from another, separate process.

If what you said was correct, then trapping and burying "mouseDown" ought not to allow the menu button to "fire", that is, the menuItems ought not to appear at all. But they do, so "mouseDown" does not seem to affect that action. And if the menu button is enabled sufficiently to display the menuItems, I assert it is independent enough to allow the menuPick message to be sent.

It does not. "MenuPick" is not sent at all.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: mouseDown cripples menuPick

Post by dunbarx » Tue May 15, 2018 2:21 pm

Bogs.
Well, like I said, maybe I just (still) don't understand the whole path thingie
Of course you do. But I want you to tell Jacque that messages go "up" the hierarchy and not "down". She will not listen to me.

Craig

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

Re: mouseDown cripples menuPick

Post by bogs » Tue May 15, 2018 4:48 pm

dunbarx wrote:
Tue May 15, 2018 2:21 pm
I want you to tell Jacque...
You want what?!
Image

On a more serious note, I'm glad I don't (still) completely misunderstand how it is supposed to work :wink:
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: mouseDown cripples menuPick

Post by jacque » Tue May 15, 2018 4:54 pm

I have given up on directional references. I now use "before" and "after". That accommodates any mental model. Personally I think of the path as a road from one location to another.

I just recently learned that mouseUp is an artificially generated message, since the OS doesn't notify about it. Perhaps blocking mouseDown affects that. I'd assume also that menuPick is artificially generated after a mouseDown when the engine determines the target is a menu object.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: mouseDown cripples menuPick

Post by dunbarx » Tue May 15, 2018 5:47 pm

Jacque.

If I change the mouseDown handler to:

Code: Select all

on mouseDown
   exit mouseDown
   --not "exit to top"
end mouseDown
The "menuPick message is sent.

But are we then both still right, that mouseDown informs menuPick? I am having trouble wrapping my head around the difference, but of course, I do not know what goes on under the hood.

"Before" and "after", eh? We will have to redraw the hierarchy horizontally. But then can we still call it a "hierarchy"? :wink:

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: mouseDown cripples menuPick

Post by FourthWorld » Tue May 15, 2018 8:14 pm

menuPick is sent after the mouse is up in a menu. The mouse can only come up, of course, after it has been down. If a mouseDown handler bypasses normal event handling with "exit to top", subsequent messages dependent on that message do not happen.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: mouseDown cripples menuPick

Post by SparkOut » Tue May 15, 2018 9:02 pm

jacque is right (before/along a road), but she was also right before (down/in). But turtles are most right (swimming/floating downriver).

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: mouseDown cripples menuPick

Post by dunbarx » Tue May 15, 2018 9:46 pm

Richard wrote:
If a mouseDown handler bypasses normal event handling with "exit to top", subsequent messages dependent on that message do not happen.
As surmised, though only broadly; menuPick "depends" on mouseDown.

But I still am trying to grok the difference between simply exiting a mouseDown handler and exiting all the way to the engine. Exiting the mouseDown handler obviously leaves some memory of the mouseDown event in the engine, whereas exiting to top does not.

There has to be something "queued", or set up internally.

"MouseUp" does not fire at all in a menu Button, and "menuPick" therefore is not dependent on mouseUp. It ought to be, though.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: mouseDown cripples menuPick

Post by jacque » Tue May 15, 2018 10:42 pm

dunbarx wrote:
Tue May 15, 2018 9:46 pm
But I still am trying to grok the difference between simply exiting a mouseDown handler and exiting all the way to the engine.
Exiting a handler returns it to the queue where it continues along the message path. Exiting to top specifically exits the message path entirely, effectively killing the message. Exit to top is what we used to call "exit to HyperCard".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: mouseDown cripples menuPick

Post by bogs » Wed May 16, 2018 6:12 am

@Jacque-
Hm, I think I almost understand that. I'm not sure I agree with it being that way, but it isn't like I'd be changing it either.
SparkOut wrote:
Tue May 15, 2018 9:02 pm
But turtles are most right (swimming/floating downriver).
...but not if I'm swimming and they are snappers :twisted:
Image

Post Reply

Return to “Talking LiveCode”