In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
Home page Home page Home page Home page
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel

Version 3 Technical Highlights - INRECT

To support the new mouse functionality several new routines have been added, including an assembler function called InRect (short for "In Rectangle") which is used to ascertain whether a given XY location is within a predefined rectangle (or rectangles) on screen. The routine takes three parameters as follows

           X   The X position of the known location
           Y   The Y position of the known location
   Rectangle   The coordinates of the rectangle(s) the XY position should be
               checked against.
      Result   The fourth parameter (which seems to be optional) merely
               replicates the result of the function.

Rectangle is made up of the X/Y positions of the top left and bottom right of the desired rectangle. Each coordinate is encoded as its corresponding Ascii character, thus a box beginning at 2,4 and ending at 10,10 would be passed as \02040A0A\, or as the literal string. Note that multiple boxes can be checked, by making Rectangle a multiple of four bytes with each four bytes representing a new rectangle location. Thus to check if the mouse position falls within two defined rectangles, 2,4 by 6,8 and 9,4 by 13,8, RECTANGLE would be passed as \0204060809040D08\..

The function result is the Rectangle number the X/Y position was found in. Thus in the above example, if the X/Y position was 12,6 the function would return 2. If it was 3,7 the function would return 1. If it fell outside the rectangles the function would return 0.

Note that this can just as easily be used to check points on the screen (for Radio Buttons et al). In this case simply pass the Top Left and Bottom Right coordinates identically, thus describing a character on the screen. Checking for a mouse click at 4,4 or 4,10 would then become a case of setting rectangle to 04040404040A040A.

Note, this function in itself does not check the mouse, it merely checks X/Y locations which must be queried from the mouse directly using MOUSE_SUBS q.v..

(Volume 4, Issue 5, Page 7)
Pixel Footer R1 C1 Pixel