Tool Shed
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Tool Shed
Jacque.
Interesting. Palette mode makes the messages go down?
Craig
Interesting. Palette mode makes the messages go down?
Craig
Re: Tool Shed
Jacque usually has the best advice.
I have second-best advice, usually. This works. Just for visuals, make the field a little taller:
I have second-best advice, usually. This works. Just for visuals, make the field a little taller:
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 checkLoc
Re: Tool Shed
Palettes are locked to browse mode.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Tool Shed
But then how would Richmond select a graphic tool? Such a command would be ignored.Palettes are locked to browse mode.
Craig
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Tool Shed
This is like grasping for a rabbit's tail through a solid concrete wall.
Re: Tool Shed
Richmond.
Did you try my kluge? It likely needs tweaking, but seems to load the right tool at the right time.
A running "send in time" gadget seems to bypass the message locking problem. In a sense, "messages" are sent during graphic tool time. Even if you roll your own, you will likely need to do something similar.
Craig
Did you try my kluge? It likely needs tweaking, but seems to load the right tool at the right time.
A running "send in time" gadget seems to bypass the message locking problem. In a sense, "messages" are sent during graphic tool time. Even if you roll your own, you will likely need to do something similar.
Craig
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Tool Shed
No, not yet, and had a long day, so going to have a good, long soak in the bath, and I'll give it
a bash tomorrow.
Although the whole thing that one cannot switch back out of a paint tool easily does strike me as a bit odd.
a bash tomorrow.
Although the whole thing that one cannot switch back out of a paint tool easily does strike me as a bit odd.
Re: Tool Shed
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.
Note I don't have time to test this, I'm deep in the weeds over here, but it's worth a try.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Tool Shed
i have a graphic on which i can move other graphics to a certain area, but on which i also can draw. It's not perfect, but works a certain bit.
I also change layers, and copy a script to the new graphic. Maybe it's of use for your problem.
I a few buttons Like Draw and Move items(stop drawing)
Button draw:
button move (this stops the drawing)
I just copied it from my stack.
Is this something you can use?
I also change layers, and copy a script to the new graphic. Maybe it's of use for your problem.
I a few buttons Like Draw and Move items(stop drawing)
Button draw:
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
Is this something you can use?
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Tool Shed
At the risk of seeming churlish, for the moment, at least, I have ignored all the suggestions here.
[Currently in bed using my Xubuntu 20.04 64-bit laptop]
I have created a blank image "ZZ" and set it to layer 1.
I have this code in the cardScript:
predictably it allows the mouseDown command to work, but NOT the mouseUp command.
At least the drawing now takes place on a named image behind my buttons.
-
[Currently in bed using my Xubuntu 20.04 64-bit laptop]
I have created a blank image "ZZ" and set it to layer 1.
I have this code in the cardScript:
Code: Select all
on mouseUp
set the tool to "browse"
end mouseUp
on mouseDown
set the tool to "brush"
end mouseDown
At least the drawing now takes place on a named image behind my buttons.
-
- Attachments
-
- Simple Draw.livecode.zip
- It's a long, long way to Tipperary.
- (14.54 KiB) Downloaded 200 times
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Tool Shed
Now if I put something that feels intuitively OK in a button:
the set the tool to "browse"also does not work.
Code: Select all
on mouseUp
set the tool to "brush"
wait 5 secs
set the tool to "browse"
end mouseUp
Re: Tool Shed
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
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
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Tool Shed
Yes, I was, but, oddly enough, now being the morning in these parts, I am awake and reading your message:
"new knowledge" . . . I'm not sure how 'new' it is, or that people who have
encountered it in the past have shrugged their shoulders and not made a noise.
"Commands are useless once that sort of tool is open."
You have got to love the in-built documentation:
for what it states,
for what it states which is unbelievably out-of-date
and
for what it does not state.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Tool Shed
Slightly tangential, but trying to set up a button to generate a new image and set it to layer 1 . . . rocket science.
So wondering why this does NOT work:
MacOS 10.15.5 beta 3, LC 9.5
Aha: the 'mouseUp' statement in the card is blocking that.
So wondering why this does NOT work:
Code: Select all
on mouseUp
create image "ZZ"
end mouseUp
Aha: the 'mouseUp' statement in the card is blocking that.

Re: Tool Shed
I 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 amAha: the 'mouseUp' statement in the card is blocking that.

