Restricting graphics to a field?

Wouter wouter.abraham at pi.be
Sun Jan 18 20:31:03 EST 2004


On 18 Jan 2004, at 17:06, use-revolution-request at lists.runrev.com wrote:

> Message: 4
> Date: Sun, 18 Jan 2004 02:07:45 EST
> From: FlexibleLearning at aol.com
> Subject: Re: Restricting graphics to a field?
> To: use-revolution at lists.runrev.com
> Message-ID: <15f.2aaeb506.2d3b8ac1 at aol.com>
> Content-Type: text/plain; charset="US-ASCII"
>
>>>  on checktool
>>>    if the tool <> "browse"
>>>    then choose browse tool
>>>    send "checktool" to me in 10 milliseconds
>>>  end checktool
>>>
>>> this looks suspiciously like...
>>> on idle!
>
>> Yes, it is the cpu-friendly way to do idle.
>
> It will also prevent you selecting any other tool. A back-door trap 
> may be
> useful such as 'if the shiftkey is down and the tool <>"browse tool" 
> then...'
>
> /H

As the mousemove handler is not suspended in Revolution when choosing
a graphic, paint or pointer tool, there is still another way to do this.
In this example the canvas is outside of the field.
Set  the script of the card to:

on mousemove
   if the mouseloc is  within the rect of fld "border" then set the 
cantmodify of this stack to true
   else set the cantmodify of this stack to false
end mousemove

### if the mouse leaves the card and/or if the "border" field is flush 
with or passing the sides of the card
on mouseleave
   if the short name of the target is in "card id < id of your card 
 >,border" then set the cantmodify of this stack to false
end mouseleave

Greetings,
WA



More information about the use-livecode mailing list