Contents of the RODENT.DOC file

Adapted from an article in "The Linker" the monthlynewsletter of the Professional Association of DatabaseDevelopers,June 1988---------------------------------------------------------

Clipper developers can use UDF's created in Assembler todirectly interrogate the mouse driver. There are numerousadvantages and disadvantages to this approach - the keydisadvantage is that the developer must constantly call themouse driver to determine the status of the mouse. Thismeans that the developer cannot rely on any "wait state"input (accept, input, read, wait, ...) if they wish to usethe mouse as an alternative to the keyboard at the sametime. The structure of the most simple code changes from:

As you can see, the code modifications required toincorporate the mouse into your applications is no trivialundertaking. The inability to use the mouse in "wait-state"input may make it's use, in other than the keyboardemulation mode, impractical for many applications (if allyou require is keyboard emulation, see some of the otherpackages available on the market).

Now that you've seen what is involved in adding mousesupport to your programs, lets examine the functionsrequired for basic mouse support. The object file RODENT.OBJcontains 11 functions to support low level calls to anyMicrosoft compatible mouse driver (including IBM, Logitechand most others). It will support applications in the 25row, 80 column text mode only.

None of the functions do any error checking, the developermust insure the values passed to MTOPOS and MAREA are valid.If there is no center button the mouse, the result ofcalling mcenter will depend upon the driver loaded(Microsoft's drivers will return .F.).

Using the above functions, we can monitor the mouse'smovement and button status, enabling the creation of pop-upboxes such as:

The structure outlined above is basic to most programs thatmake use of the mouse, more complicated programs can offer avariety of actions depending upon the position of the mousecursor and the button press/release sequence.

Once you have created functions that are mouse "aware", youcan easily add support for other alternative input devices(including my personal favorite - the light pen, support forwhich can be found in "LIGHTPEN", available from the samefriendly disks from where you plucked this) to your code.

A full demo of the mouse functions is included in thisarchive, entitled "MDEMO.PRG". Compile MDEMO and link itwith RODENT (i.e. "link mdemo rodent,,,clipper") to try themouse for yourself!