Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FreshWin (c) Fresh Technologies - <b>msinregion() mouse function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  MSINREGION()                                                Mouse Function
 Purpose..: Test if a mouse is in a screen region
-------------------------------------------------------------------------------
 Syntax...: MsInRegion( [<nT|aReg> [, <nL> [, <nB> [, <nR>]]]] ) --> lRet|nRet

 Arguments: [<nT|aReg>] = If an array is passed, the 3 remaining
                          parameters are invalid and MsInRegion()
                          checks the array. The function returns zero,
                          if not found. It returns the subscript of
                          the array, if it IS found. If <nT> is passed,
                          it represents the top row of the region to check.

            [<nL>]      = the left column of the screen
                          region to check.

            [<nB>]      = the bottom row of the screen
                          region to check.

            [<nR>]      = the right column of the screen
                          region to check.

 Returns..: nPos - the array subscript in which the mouse was found.
            lRet - TRUE if mouse was found in screen region.

 Remark...: This function is a multi-purpose function. Its return
            value is based on what parameters are sent. If a single
            dimension array of 4 elements is sent, MsInRegion() will
            return either 0 ( not found ) or 1 ( found ). If an array
            is sent with each element containing a single dimension
            array of 4 elements, 0 is returned if no sub-array quadrant
            contained the mouse cursor or <n> representing the
            subscript of the array that the cursor was found in. If four
            numeric parameters are sent, TRUE is returned if the mouse
            was found in these four parameters, otherwise FALSE.

 Source...: MSMETA.PRG
-------------------------------------------------------------------------------
 Example..: . The example uses a nested array of screen regions to
              check. This is useful in processing screen HOT SPOTS.
              The example assumes that you have four boxes at the
              bottom of the screen in the regions given by the array.
              These boxes can be thought of as activation or ON|OFF
              buttons.

            #define HS_HELP  1
            #define HS_SAVE  2
            #define HS_EDIT  3
            #define HS_EXIT  4

            aScrHot := { { 20, 01, 23, 04 },; // HELP button position
                         { 20, 05, 23, 09 },; // SAVE button position
                         { 20, 10, 23  14 },; // EDIT button position
                         { 20, 15, 23, 19 } } // EXIT button position

            nKey := MsInKey( 0, @nPress )
            nPos := MsInRegion( aScrHot )

            if nMsPress == MB_LEFT
               do case
               case nPos == HS_HELP
                  Help()

               case nPos == HS_SAVE
                  Save()

               case nPos == HS_EDIT
                  Edit()

               case nPos == HS_EXIT
                  QuitProc()

               endcase
            endif


            . This next example checks for a single area of the screen.

            if MsInRegion( 0, 0, 0, 0 )
               ? "Mouse is in the upper left hand corner of screen..."

            endif

See Also: MsRow() MsCol() MsStatus()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson