Re: Tool Shed
Posted: Thu May 07, 2020 6:06 pm
Jacque.
Interesting. Palette mode makes the messages go down?
Craig
Interesting. Palette mode makes the messages go down?
Craig
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Code: Select all
on mouseEnter
put "browse" into fld 1
set the tool to "browse"
end mouseEnter
on mouseLeave
checkLoc
put "pencil" into fld 1
set the tool to "pencil tool"
end mouseLeave
on checkLoc
if the optionKey is down then exit to top
put the mouseLoc into line 2 of fld 1
if the mouseLoc is within the rect of btn 1 then set the tool to "browse" else set the tool to "pencil"
send "checkLoc" to me in 1
end checkLocPalettes are locked to browse mode.
But then how would Richmond select a graphic tool? Such a command would be ignored.Palettes are locked to browse mode.
Not exactly. While clicking in a palette, is reacts as though you have the browse tool selected and the cursor changes to browse. When you mouse away, it returns to whatever it was. You can change the tool and when you leave the palette, the current tool should be active.dunbarx wrote: Thu May 07, 2020 6:50 pmBut then how would Richmond select a graphic tool? Such a command would be ignored.Palettes are locked to browse mode.
Code: Select all
global gColor,gLSize,gTrans
on mouseUp
if there is not a graphic"draw" then
create graphic"draw"
--set the width of graphic"draw" to the width of image"nl+road.svg" --not needed as the graphic becomes as big as you draw
--set the height of graphic"draw" to the height of image"nl+road.svg"
--set the loc of graphic "draw" to the loc of image"nl+road.svg"
set the layer of graphic"draw" to top
choose polygon tool -- or pencil
--set the defaultCursor to arrow
set the script of graphic ("draw") to \
"global gColor,gLSize" & cr & \
"on mouseLeave" & cr & \
"choose browse tool" & cr & \
"end mouseLeave" & cr & cr & \
"on mouseEnter" & cr & \
"set the foregroundcolor of me to gColor" & cr & \
"set the lineSize to gLSize" & cr & \
"choose polygon tool" & cr & \ --or pencil
"end mouseEnter" & cr & cr & \
"on mouseUp" & cr & \
"choose pointer tool" & cr & \
"end mouseUp" & cr & cr & \
"on mouseDown theButton" & cr & \
"if theButton is 1 then" & cr & \
"choose polygon tool" & cr & \
"else" & cr & \
"if theButton is 3 then" & cr & \
"choose Eraser tool" & cr & \
"end mouseDown"
--set the penColor to gColor
set the foregroundcolor of graphic"draw" to gColor
set the opaque of graphic"draw" to false
set the lineSize of graphic"draw" to gLSize
set the blendLevel of graphic"draw" to gTrans
set the style of graphic"draw" to "polygon"
set the disabled of btn"Erase" to false
else
set the layer of graphic"draw" to top
choose polygon tool
--set the defaultCursor to arrow
set the script of graphic ("draw") to \
"global gColor,gLSize" & cr & \
"on mouseLeave" & cr & \
"choose browse tool" & cr & \
"end mouseLeave" & cr & cr & \
"on mouseEnter" & cr & \
"set the foregroundcolor of me to gColor" & cr & \
"set the lineSize to gLSize" & cr & \
"choose polygon tool" & cr & \
"end mouseEnter" & cr & cr & \
"on mouseUp" & cr & \
"choose pointer tool" & cr & \
"end mouseUp" & cr & cr & \
"on mouseDown theButton" & cr & \
"if theButton is 1 then" & cr & \
"choose polygon tool" & cr & \
"else" & cr & \
"if theButton is 3 then" & cr & \
"choose Eraser tool" & cr & \
"end mouseDown"
--set the penColor to gColor
set the foregroundcolor of graphic"draw" to gColor
set the lineSize of graphic"draw" to gLSize
set the opaque of graphic"draw" to false
set the blendLevel of graphic"draw" to gTrans
set the style of graphic"draw" to "polygon"
set the disabled of btn"Erase" to false
end if
end mouseUp
on mouseEnter
-- send "choose browse tool" to me in 1 tick
-- set the defaultCursor to arrow
end mouseEnter
Code: Select all
on mouseUp
choose Browse tool
set the layer of graphic"draw" to 2
end mouseUp
#on mouseEnter
#send "choose browse tool" to me in 1 tick
-- set the defaultCursor to arrow
#end mouseEnter
Code: Select all
on mouseUp
set the tool to "browse"
end mouseUp
on mouseDown
set the tool to "brush"
end mouseDown
Code: Select all
on mouseUp
set the tool to "brush"
wait 5 secs
set the tool to "browse"
end mouseUpYes, I was, but, oddly enough, now being the morning in these parts, I am awake and reading your message:dunbarx wrote: Thu May 07, 2020 10:56 pm Richmond.
You are probably asleep.
This makes sense in light of the new knowledge that paint and graphic tools shut down the whole world just like COVID-19. Commands are useless once that sort of tool is open.
Craig
Code: Select all
on mouseUp
create image "ZZ"
end mouseUpI just woke up, since it is now what is largely considered the middle of the night here, but I am curious how you determined that a mouseUp event on a card is blocking a mouseUp event in a button script which, as far as I can think at the moment is impossiblerichmond62 wrote: Fri May 08, 2020 8:23 am Aha: the 'mouseUp' statement in the card is blocking that.