[futurebasic] Re: PG And PointInRect

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Sat, 22 Nov 1997 10:58:53 -0600
Terence wrote:
> I would suppose I use PtInRect, but how does that work??

FN PTINRECT(pt, rect) returns a nonzero value if the given point (pt) is
within the given rectangle (rect).

pt should be a 4-byte structure (i.e., DIM pt.4), while rect should be
an 8-byte structure (i.e., DIM rect.8).  Here is a simple demo:

DIM gRect.8
END GLOBALS
LOCAL FN DoMouse
  DIM pt.4
  evnt = MOUSE(0)
  pt.h% = MOUSE(_horz)
  pt.v% = MOUSE(_vert)
  LONG IF FN PTINRECT(pt, gRect)
    BEEP
  END IF
END FN

WINDOW OFF
WINDOW 1: CLS
PRINT "Click in the rectangle:"
CALL SETRECT(gRect, 10,10,100,50)
CALL FRAMERECT(gRect)
ON MOUSE FN DoMouse
DO
  HANDLEEVENTS
UNTIL _false

Hope this helps.
- Rick