Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TSDWIN: Clipper 5.0 Interface Library - <b>mouse programming:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Mouse Programming:
 ----------------------------------------------------------------------------

 When you decide to tackle programming for the mouse you have to
 remember that the mouse works on a virtual screen eight times the
 size of the normal eighty column text screen. Also, BIOS returns
 values in terms of ( x, y ) coordinates with the top left corner
 as origin. The rows and columns in Clipper therefore are found
 with:

               Rows: INT( Y / 8 )
            Columns: INT( X / 8 )

 As with any interface, a mouse driver takes time to operate.
 Considering the speed with which you can move the mouse cursor
 around the screen, it is no wonder that you sometimes have to give
 the mouse software time to catch up. In most TSDWIN mouse oriented
 functions, there is a parameter called nSleep or nTimeOut, which
 is a pause time to allow the mouse to settle. When you press a
 button, you normally want something to happen only once, so the
 nSleep parameter can be important. An example is found in
 twACChoice() when disallowed elements are encountered. A pause
 time is necessary in order to keep the highlight bar from zipping
 to the top or bottom of the display. At least that's why for the
 way it is now programmed.

 When using button presses to signal actions, you can repeat an
 action very quickly, many times unless you insert some code like:

         DO WHILE ( _twM3B() = nButton );ENDDO

 All this does is stay put until the mouse button is release. Use
 the button number if it matters, or just check for any return.

 Probably the most important thing you will have to deal with is
 the mouse cursor. If you stop to think about it, the mouse cursor
 does not flit across the screen by magic. The mouse software is
 actually saving and restoring the cursor region as the mouse
 moves. Therefore, if you plan on writing to the screen at all,
 which you will do if you execute code from an action block or
 ActionKeys from a TSDWIN function, be careful. We have tried to
 remember to turn off the mouse cursor when executing your code,
 but we may have forgotten some. To do it, the fastest way is:

    Mouse Cursor Off: _twM2()
     Mouse Cursor On: _twM1()

 However, if you use TSDWIN interface functions exclusively, you
 should not have to worry about this too much. If you find your
 screen has 'mouse droppings' all over it, you know you need to
 look for places to hide and show the mouse cursor. (See 14. Mouse
 Support)

 The new twPause() and twStopWatch() functions were introduced to
 allow you to program delay times easily.



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