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>msrelcnt() mouse function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  MSRELCNT()                                                  Mouse Function
 Purpose..: Return the number of mouse button releases
-------------------------------------------------------------------------------
 Syntax...: MsRelCnt( [<nButton>] ) --> nReleases

 Arguments: [<nButton>] = the mouse button to check. The default is
                          MB_LEFT. Valid button numbers are defined in
                          FW_MAIN.CH as follows:

              Mouse Button Translate Directives as found in FW_MAIN.CH
              --------------------------------------------------------
              Value  FW_MAIN.CH   Button(s) pressed
              --------------------------------------------------------
              0      MB_NONE      none
              1      MB_LEFT      left
              2      MB_RIGHT     right
              3      MB_LT_RT     middle
              4      MB_MIDDLE    left and right
              5      MB_LT_MD     left and middle
              6      MB_MD_RT     middle and right
              7      MB_ALL       all buttons pressed
              --------------------------------------------------------

 Returns..: nReleases is the number of mouse button releases for the
            button passed since the last mouse function call.

 Source...: MSBUTREL.C
-------------------------------------------------------------------------------
 Example..: . You can use MsRelCnt() to check for a double click.
              You can specify a timeout for the double click as well
              as an x and y coordinate to make sure the mouse wasn't
              moved during the double click wait interval. First,
              you check for a mouse press. If you have a valid mouse
              press, then you call isDblClick() which issues an
              inkey() for the double click wait interval passed. Then,
              it checks MsRelCnt(). If MsRelCnt() is larger or
              equal to two, the mouse was released AT LEAST twice
              during the wait interval. Hence, a double click has
              ocurred.

              local nButton

              MsInkey( 0, @nButton )

              if nButton == MB_LEFT  // Left mouse button was pressed
                 /*
                  The following call to isDblClick() will
                  print true only if the left button was released
                  twice within the period of one half second and
                  the mouse stayed on the coordinates row 5 and
                  column 10.
                  */
                 ? isDblClick( MB_LEFT, .5, 5, 10 )

              endif

              ...

              FUNCTION isDblClick( nButton, nWait, nX, nY )

                 inkey( nWait )  // Wait specified time interval

              RETURN ( MsRelCnt( nButton ) > 1 .and.;
                       MsRow() == nX           .and.;
                       MsCol() == nY )

See Also: MsStatus() MsIsRel()

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