Page 1 of 1

Why Am I Always a Beginner???

Posted: Mon Mar 09, 2020 11:44 pm
by dunbarx
I make any kind of menu-style button. I put something really complex in its script:

Code: Select all

on menuPick pItemName
   put pItemName 
end menuPick

on mouseDown
end mouseDown
Works fine. BUT, if I comment out the "mouseDown" handler, it does not work at all; the menuPick handler does not fire.

I was playing with an long time running stack, and all of a sudden it did not work. I only knew about the mouseDown message because the Message Watcher told me it was sent. I was not surprised at that. I am surprised, however, about the other stuff. I never needed to trap and bury "mouseDown" before.

Passing "mouseDown" in its handler also (no surprise, sort of) disables the menu.

Craig

Re: Why Am I Always a Beginner???

Posted: Mon Mar 09, 2020 11:49 pm
by FourthWorld
I use menuPick all the time, and very rarely with a mouseDown handler in the same script. Can you post a sample stack with this anomaly?

Re: Why Am I Always a Beginner???

Posted: Tue Mar 10, 2020 12:38 am
by dunbarx
Richard.

Just saw your post as I was making a test on my home computer. Works fine without any "mouseDown" nonsense.

This is not the first time I have found weird things happening to my work Mac. Tomorrow I will restart the machine and see ( I had already quit and reopened LC).

The workaround (trap and bury "mouseUp"), if you can call it that, seems stable. It may be me that is not stable.

Watch this space...

Craig

Re: Why Am I Always a Beginner???

Posted: Tue Mar 10, 2020 8:57 am
by richmond62
I'm a beginner after about 19 years of RR/LC and about 44 years trying to program computers
so I don't know why you are asking that question. 8)

Re: Why Am I Always a Beginner???

Posted: Tue Mar 10, 2020 9:56 am
by bogs
I am a little confused, Craig.... your first post specifically listed this code:
on menuPick pItemName
put pItemName
end menuPick

on mouseDown
end mouseDown

and then specifically said
dunbarx wrote:
Mon Mar 09, 2020 11:44 pm
Works fine. BUT, if I comment out the "mouseDown" handler, it does not work at all; the menuPick handler does not fire.
After Richard's answer you said :
Just saw your post as I was making a test on my home computer. Works fine without any "mouseDown" nonsense...
...
The workaround (trap and bury "mouseUp"), if you can call it that, seems stable. It may be me that is not stable.
Which is it? mouseUp? mouseDown? both? neither?

Aside from that, I would like to know if you have {mouseDown or mouseUp} elsewhere further down the message path in the code. If you do, then that would likely be the reason you need to trap {mouseDown or mouseUp} for that object, as I am pretty sure that {mouseDown or mouseUp} takes precedence over menuPick Image

Re: Why Am I Always a Beginner???

Posted: Tue Mar 10, 2020 11:48 am
by richmond62
menuPrick.png
-
This stack has a mouseDown in both the card and in the drop-down menu.

When you click on the drop-down menu the mouseDown fires first, followed by the menuPick.

Re: Why Am I Always a Beginner???

Posted: Tue Mar 10, 2020 12:58 pm
by dunbarx
The reason I will always be a beginner is because I am lazy.

The stack in question has a mouseDown handler in the card script. That handler tests a custom property, such that if that condition is not met, it exits to top. My poor menuButton had no idea of that. The handler was meant to deal with quite other issues.

That is why I have to head "mouseDown" off at the pass in the button.

Thanks to all for bearing with me, as I learn how LC actually works.

Craig

Re: Why Am I Always a Beginner???

Posted: Fri Mar 13, 2020 10:05 pm
by sritcp
zen.png