Page 1 of 3
Tool Shed
Posted: Thu May 07, 2020 9:31 am
by richmond62
I have a button containing this code:
Code: Select all
on mouseEnter
set the tool to "browse"
end mouseEnter
on mouseLeave
set the tool to "brush"
end mouseLeave
So, when I move my
mouse pointer to click on the button it should change the cursor
to the
browse tool, and when I pull away from the button it should change the cursor
to the
brush tool.
The script successfully turns the cursor to the
brush tool, but seems unable to change it back to the
browse tool.
Re: Tool Shed
Posted: Thu May 07, 2020 10:27 am
by bogs
Looks like a bug to me. Also looks like it goes all the way back to Mc 2.5 (the original, not the OSS version).
Re: Tool Shed
Posted: Thu May 07, 2020 11:18 am
by jmburnod
Hi,
Same result as Richmond here (LC 9.5.0,OSX 10.13)
Best
Jean-Marc
Re: Tool Shed
Posted: Thu May 07, 2020 11:48 am
by richmond62
I don't think it is a bug, but it is a problem.
I suspect that as soon as the
brush tool is set a new empty image is created which overlays the control
containing the
mouseLeave command.
Um . . . No . . . that only happens once one does a
mouseDown with the brush tool.
In that case it is necessary to find the name of the new image and send it backwards so that it is on a lower layer to the button.
This is a problem because, ideally, the script to do this would be in the newly created image.
Putting this sort of thing into the cardScript does not work:
Code: Select all
on mouseUp
set the name of the last img to "ZZ"
end mouseUp
because the new image overlays the card and traps the mouseUp signal.
Re: Tool Shed
Posted: Thu May 07, 2020 12:30 pm
by richmond62
Probably time to 'fess up . . .
I am trying to work up a very primitive drawing "thing" for my wife to use with
Jitsi Meet, and myself with
Zoom
(for our online teaching stuff) to allow us to draw pictures which our victims can see in real time.
-
-
The central idea, such as it is, is that the end-user should be able to change the brushColor
by visiting one of the squares at the top of the window:
Code: Select all
on mouseEnter
set the tool to "browse"
end mouseEnter
on mouseDown
set the tool to "brush"
set the brushColor to the backGroundColor of me
end mouseDown
Re: Tool Shed
Posted: Thu May 07, 2020 12:31 pm
by sphere
I have a stack with similar comands as Richmond.
Don't have it with me at the moment
But i also want to change between the pointer and brushes or pencil.
Have to check tonight if i keep it in mind, see how it works, cause i stopped it then as it does not work well on Android(there is a old bugreport for it) as brushes seemed not to be copied over in the standalone.
I wanted to use it on very big touch screens which have android, but can also work with Windows/Mac using Tuio touch protocol
Re: Tool Shed
Posted: Thu May 07, 2020 2:20 pm
by dunbarx
I have forever had a plug-in that allow me to use a right click on my mouse to switch between the browse and pointer tools. Very convenient.
A slight modification, and this works for me:
Code: Select all
switch
case tKey = 65482 and the tool = "pointer tool" --RIGHT CLICK
choose "brush tool"
break
case tKey = 65482 and the tool = "brush tool" --RIGHT CLICK
choose "pointer tool"
break
But this does not translate to the mouseEnter and mouseLeave messages. So, a bug?
Craig
Re: Tool Shed
Posted: Thu May 07, 2020 2:30 pm
by dunbarx
Maybe it is not a matter of the mouseEnter or mouseLeave messages.
ALL of the graphic and the paint tools will "lock out" the ability of either of the above messages. With a field somewhere:
Code: Select all
on mouseEnter
set the tool to "browse"
put random(99) into fld 1
end mouseEnter
on mouseLeave
set the tool to "pencil tool"
put random(99) into fld 1
end mouseLeave
You get a number in the field on mouseEnter, in the browse tool, but once mouseLeave fires the first time (you get another number), neither of those messages are ever sent again, and this seems to apply to all the paint and graphic tools.
Craig
Re: Tool Shed
Posted: Thu May 07, 2020 2:45 pm
by dunbarx
Have not done a lot of testing, but the paint and graphic tools suppress most messages. Not RawKeyWhatever, but most others.The message watcher becomes very quiet when fooling around with those tools.
Is this normal behavior?
Craig
Re: Tool Shed
Posted: Thu May 07, 2020 3:51 pm
by richmond62
dunbarx wrote: ↑Thu May 07, 2020 2:45 pm
the paint and graphic tools suppress most messages.
Is this normal behavior?
All the drawing tools would have to suppress some messages as drawing operations might be interfered with by mouseDown and
mouseUp messages, or, put another way:
maybe mouseDown, mouseStiilDown and so on are used in the operation of the paint tools.
This does not explain the mouseEnter and mouseLeave messages being ignored.
HOWEVER . . . if there were a way to rename the image created when a paint tool is used so that that image can be sent to
the bottom layer of a card so other controls (buttons and so on) could receive mouse signals that would not matter.
Re: Tool Shed
Posted: Thu May 07, 2020 3:56 pm
by bogs
Why not reverse that, and layer the button up, since you already know all about the button.
Re: Tool Shed
Posted: Thu May 07, 2020 4:42 pm
by richmond62
bogs wrote: ↑Thu May 07, 2020 3:56 pm
Why not reverse that, and layer the button up, since you already know all about the button.
Clever, clever.
How do you do that when, while you are using the brush tool you cannot send a mouse message anywhere to
layer the button up?
Re: Tool Shed
Posted: Thu May 07, 2020 5:22 pm
by dunbarx
How do you do that when, while you are using the brush tool you cannot send a mouse message anywhere to
layer the button up?
Kluge, kluge, kluge.
Code: Select all
on mouseEnter
set the tool to "browse"
end mouseEnter
on mouseLeave
checkLoc
set the tool to "pencil tool"
end mouseLeave
on checkLoc
put the mouseLoc into fld 1
send "checkLoc" to me in 1
end checkLoc
The tool changes, and the mouseLoc appears in fld 1. Now use that information to see if the mouseLoc is within the rect of the button, and act accordingly.
Craig
Re: Tool Shed
Posted: Thu May 07, 2020 5:34 pm
by richmond62
The tool changes, and the mouseLoc appears in fld 1. Now use that information to see if the mouseLoc is within the rect of the button, and act accordingly.
Ah, but, I then drag my paint brush around for a bit, them mouseUp, and then move my pointer back over the button . . .
. . . by that time the
checkloc has been and gone quite some time ago.
Fioch, off to have my supper . . . and then I'll start messing around again.
Re: Tool Shed
Posted: Thu May 07, 2020 5:48 pm
by jacque
This has been standard behavior since MC 1.0. Try putting your tool buttons in a stack set to palette mode, I believe that handles the problem for you.
This won't work in mobile apps, it's desktop only.