deslecting the line tool

David Vaughan drvaughan55 at mac.com
Sun Feb 17 19:02:01 EST 2002


On Monday, February 18, 2002, at 02:35 , Mike Brown wrote:

> Hi Ian,
>
> Thanks for the suggestions.  I had already attempted most of the 
> examples in
> the Transcript Dictionary.  MouseWithin, MouseEnter, Send MouseUp... 
> none of
> these handlers work while the line tool is selected.  I just now tried 
> again
> and still am not having any luck.  I am looking for a behavior similar 
> to
> the Rev Tools palette.  I am also looking for any examples in the Rev
> Documentation.
>
> Thanks,
> Mike
>
>>> I have a question regarding the selection and deselection of the line 
>>> too.
>>> I have a button with this script:
>>>
>>> on mouseup
>>> set the tool to "line tool"
>>> end mouseup
>>>
>>> That sets my pointer to the line drawing tool, but I cant find a 
>>> script or
>>> method to switch back to a pointer or browse tool.  When I placed a 
>>> script
>>> in another button to set the pointer to the browse tool, it doesn't 
>>> work.
>>> The line tool just draws a dot or line on top of the button.  Any
>>> recommendations?
>>
snip

Mike

I don't know if things like the mouseLoc are deprecated but this worked 
as a demonstration, and may do until someone thinks of something better.

The problem appears to be that messages halt (from what I saw) when you 
choose a drawing tool, hence none of the mouse messages (or idle) will 
help. Therefore, we need our own monitor. This is my working demo.

local LmsgID

on mouseUp
   choose line tool
   send "toolMonitor" to me in 500 milliseconds
   put the result into LmsgID
   -- This was a failsafe line used while debugging
   -- send "getOut" to me in 10 seconds
end mouseUp

on toolMonitor
   if within(button "reBrowse",the mouseLoc) then
     getOut
   else
     send "toolMonitor" to me in 500 milliseconds
     put the result into LmsgID
   end if
end toolMonitor

on getOut
   choose Browse tool
   cancel LmsgID
end getOut

regards
David




More information about the Use-livecode mailing list