Checking for being on the border of a control

Doug Lerner doug at webcrossing.com
Wed Mar 24 23:54:58 EST 2004


I ended up doing it like this, which seems to work ok. I guess it is alright
doing it this way (inside a mouseMove handler, after I've determined I'm in
the object:

      put the rectangle of lastObject into outerRect
      put the borderWidth of lastObject into thisBorderWidth
      put (the left of lastObject) + thisBorderWidth into innerLeft
      put (the top of lastObject) + thisBorderWidth into innerTop
      put (the right of lastObject) - thisBorderWidth into innerRight
      put (the bottom of lastObject) - thisBorderWidth into innerBottom
      put innerLeft,innerTop,innerRight,innerBottom into innerRect
      if the mouseLoc is within innerRect then
        addToStatus "inside " & lastObject
      else if the mouseLoc is within outerRect then
        addToStatus "on the border of " & last Object
      end if

The last else if could really be just an "if", but "just in case" I screwed
up and was not really within the object it seemed safer to add that.

doug



More information about the use-livecode mailing list