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>msinkey() mouse function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  MSINKEY()                                                   Mouse Function
 Purpose..: Replace the Clipper inkey() command
-------------------------------------------------------------------------------
 Syntax...: MsInKey( [<nSeconds>], [<nMsButton>],
                     [<lClearPress>] ) --> nKey

 Arguments: [<nSeconds>]     = specifies the number of seconds MsInKey()
                               waits for a key or mouse press. The value
                               can be specified in increments as small as
                               1/10 of a second. Specifying 0 halts the
                               program until a key or mouse press is
                               detected. If <nSeconds> is omitted, MsInKey()
                               does not wait at all but will return what is
                               in the keyboard or mouse queue in the same
                               way that inkey() works.

            [<nMsButton>]    = the parameter should be passed by
                               reference and will contain the numeric value
                               of the mouse button pressed or 0, if none.

            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
            ------------------------------------------------------

           [<lClearPress>]  = if a mouse press is detected. The
                              parameter will make sure that all mouse
                              presses are cleared before continuing. The
                              parameter is especially important for those
                              times when you want to grab one full press
                              and release. TRUE is the default. For continual
                              mouse polling functions like scroll bars, you
                              would want to set this to FALSE.

 Returns..: nKey is the Clipper inkey() code. It returns an
            integer numeric value from -39 to 386, identifying
            the key extracted from the keyboard buffer and, as such,
            returns values for all ASCII characters, function,
            Alt-function, Ctrl-function, Alt-letter, and
            Ctrl-letter key combinations. The mouse button pressed will
            be contained in <nMsButton>. The function will NOT return
            a button press and a key press at the same time. With it, you
            can easily determine the type of event that has transpired.

 Remark...: The function is 99% compatible with inkey() and should
            be used to replace all of your existing calls to inkey().
            The function, as well as providing simple mouse support
            through an enhanced inkey() function, will process all CUA window
            events such as Moving, Sizing, Zooming and Closing. As well,
            the function is a valid "wait state" and will process
            SET KEY functions as well. That is the 1% incompatibility.
            Inkey() does not process SET KEY functions.

 Source...: MSINKEY.PRG
-------------------------------------------------------------------------------
 Example..: . The example uses MsInKey() to terminate a loop only if
              the user has hit the escape key or clicked the right
              hand mouse button.

            while !( nKey == K_ESC .and. nButton == MB_RIGHT )
               nKey := MsInKey( ,@nButton )
            enddo

See Also: MsStatus() MsIsPress() MsButton()

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