Why developers have flat foreheads
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Why developers have flat foreheads
Banging their heads on the desk when something simple doesn't work in my case. I have 2 buttons on a stack and 1 rectangular image, filled white. The aim is to provide a user with a simple pencil drawing tool and an eraser.
Pencil button:
on mouseDown
choose pencil tool
end mouseDown
on the eraser button:
on mouseDown
choose eraser tool
end mouseDown
on image:
on mouseLeave
choose browse tool
end mouseLeave
The first issue is that when I select 'run' mode and click the 'Pencil' button, the pencil appears but the browse/edit tools are then both deselected. In that mode, I can draw on the image with the pencil but I can't select the eraser because the "on mouseLeave/choose browse tool" isn't working. Has anyone got the time to duplicate this or otherwise offer advice?
Issue 2: if I change the script of the first button to "choose brush tool" it simply doesn't work.
Issue 3: if I select "edit" mode, the script of the rectangle "on mouse leave/choose browse tool ... " continues to run, switching the environment from "edit" to "browse".
(Bang ... bang ... bang ...)
Pencil button:
on mouseDown
choose pencil tool
end mouseDown
on the eraser button:
on mouseDown
choose eraser tool
end mouseDown
on image:
on mouseLeave
choose browse tool
end mouseLeave
The first issue is that when I select 'run' mode and click the 'Pencil' button, the pencil appears but the browse/edit tools are then both deselected. In that mode, I can draw on the image with the pencil but I can't select the eraser because the "on mouseLeave/choose browse tool" isn't working. Has anyone got the time to duplicate this or otherwise offer advice?
Issue 2: if I change the script of the first button to "choose brush tool" it simply doesn't work.
Issue 3: if I select "edit" mode, the script of the rectangle "on mouse leave/choose browse tool ... " continues to run, switching the environment from "edit" to "browse".
(Bang ... bang ... bang ...)
Hi dalkin,
implementing drawing capabilities is a bit tricky as your flat forehead can tell
Looks like these messages "mousedown/leave etc..." are not send with a drawing tool selected.
I did it in the past but used a PALETTE window for the "tools".
Another approach will be to "poll" the mouseloc continuously to act accordingly:
This is not tested, but you will get the picture.
Regards
Klaus
P.S.
Why not give the user the chance to change his mind and use "MOUSEUP" insted of "MOUSEDOWN"?
implementing drawing capabilities is a bit tricky as your flat forehead can tell

Looks like these messages "mousedown/leave etc..." are not send with a drawing tool selected.
I did it in the past but used a PALETTE window for the "tools".
Another approach will be to "poll" the mouseloc continuously to act accordingly:
Code: Select all
on mouseup
choose pencil tool
send "checktool" to me in 500 millisecs
end mouseup
on checktool
if within(the rect of img "image to be edited", the mouseloc) then
send "checktool" to me in 500 millisecs
else
choose browse tool
end if
end checktool
Regards
Klaus
P.S.
Why not give the user the chance to change his mind and use "MOUSEUP" insted of "MOUSEDOWN"?

Thanks for taking the time with this Klaus:
I've discovered that part of the problem is that "on mouseLeave" will work if applied to an image, but not to a graphic. The workaround has been to create a filled (white) rectangle (the graphic) and place it behind a filled (white) image. In this way, the cursor is restored to a browser tool when leaving the editing area - a bit messy, but it seems to work.
The only thing that remains a concern is why selecting a tool from a button with a "choose tool" command crashes the browse/edit environment.
Interestingly "checktool" from your script doesn't appear in the Transcript dictionary. Where did you come by that?
I've discovered that part of the problem is that "on mouseLeave" will work if applied to an image, but not to a graphic. The workaround has been to create a filled (white) rectangle (the graphic) and place it behind a filled (white) image. In this way, the cursor is restored to a browser tool when leaving the editing area - a bit messy, but it seems to work.
The only thing that remains a concern is why selecting a tool from a button with a "choose tool" command crashes the browse/edit environment.
Interestingly "checktool" from your script doesn't appear in the Transcript dictionary. Where did you come by that?