Within a border?
Doug Lerner
doug at webcrossing.com
Wed Mar 24 20:20:45 EST 2004
Right, that's the sort of test I was thinking of.
doug
On 3/25/04 9:18 AM, "Brian Yennie" <briany at qldlearning.com> wrote:
> How about something like:
>
> function isWithinBorder tLoc,tObject
> put the rect of tObject into tRect
> if (tLoc is within tRect) then
> if abs(item 1 of tLoc - item 1 of tRect) <= (the borderWidth of
> tObject) then return TRUE
> if abs(item 1 of tLoc - item 3 of tRect) <= (the borderWidth of
> tObject) then return TRUE
> if abs(item 2 of tLoc - item 2 of tRect) <= (the borderWidth of
> tObject) then return TRUE
> if abs(item 2 of tLoc - item 4 of tRect) <= (the borderWidth of
> tObject) then return TRUE
> end if
> return FALSE
> end isWithinBorder
>
> You could call it with something like:
>
> if (isWithinBorder(the mouseLoc, "field 1")) then...
>
> The idea being if it's within the rect, and within (borderWidth) pixels
> of the left, right, top or bottom, then it's in the border.
>
> This is untested and of course won't work with non-rectangular controls.
>
> HTH
>
> Brian
>
>> I need to detect whether the cursor is within the border area of a
>> control
>> (in this case, a field).
>>
>> I believe I can do this by using "is within", then defining two
>> rectangles -
>> one for the object (containing the border) and one for the object
>> (inside
>> the border) and doing an appropriate test with both rectangles.
>>
>> Unless Revolution has some more convenient syntax for testing for being
>> within a control's border. Does it, by any chance?
>>
>> Any caveats worth mentioning?
>>
>> Thanks,
>>
>> doug
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> This email has been screened by Engate Spam Sentinel
More information about the use-livecode
mailing list