rectangle of 0,0,0,0 ok?
Doug Lerner
doug at webcrossing.com
Sun Jan 18 19:31:01 EST 2004
OK. I'll try that!
Thanks,
doug
On 1/19/04 9:25 AM, "Scott Rossi" <scott at tactilemedia.com> wrote:
> On 1/18/04 3:49 PM, "Doug Lerner" <doug at webcrossing.com> wrote:
>
>>>> Those don't truly *hide* the field, in the sense that if you check to see
>>>> if
>>>> the mouse is in the region of the field it still turns out to be true, even
>>>> if the field is not visible.
>>>
>>> How are you testing the mouse? When I use the following script and the
>>> field is hidden, the result is consistently false:
>>>
>>> put within(fld myField,the mouseLoc)
>>
>> if exists(field "canvas") and the mouseLoc is within the rectangle of field
>> "canvas" then
>>
>> This shows true whether or not the field is hidden.
>
> That's because you're testing the rect of the field, which is a position on
> the card, as opposed to testing if the mouse is within the field object
> itself. Try testing the field itself as explained above.
>
> You can also gain speed improvements by testing variables instead of testing
> physical objects. For example, you can use properties to store the presence
> of the canvas field and its rect from other scripts, and then test the
> properties, instead of testing the actual objects. Something like:
>
> on mouseDown
> -- TEST THE SITUATION ONCE
> if exists(fld "canvas") and the visible of fld "canvas" then
> set the uCanvasRect of this cd to the rect of fld "canvas"
> set the uCanvasReady of this cd to true
> end if
> end mouseDown
>
> on mouseMove X,Y
> -- EXIT IF THE SITUATION IS NOT APPROPRIATE
> if not the uCanvasReady of this cd then exit mouseMove
> if (X&","&Y) is within the uCanvasRect of this cd then
> -- do my stuff
> else
> -- do other stuff
> end if
> end mouseMove
>
> on mouseUp
> hide fld "canvas"
> set the uCanvasReady of this cd to false
> end mouseUp
>
>
> The above may not be completely appropriate to your situation but may give
> you an idea of where to start.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, Development & Design
> -----
> E: scott at tactilemedia.com
> W: http://www.tactilemedia.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list