home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
rodent.zip
/
MDEMO.PRG
next >
Wrap
Text File
|
1988-08-31
|
4KB
|
183 lines
*** MDEMO.PRG
*** Demonstrate Mouse Interface for Clipper
*** Copyright 1988 - Lawrence Edward Nussbaum, All Rights Reserved
*** Source BDW207, Compuserve 76137,361
***
*** Mouse Interface Functions In RODENT.OBJ
***
*** ISMOUSE() - Returns .T. if Mouse Driver Installed
*** .F. if No Mouse Driver
***
*** MRESET() - Returns # of Buttons On Mouse,
*** 0 if no Mouse
***
*** MSHOW() - Displays Mouse Cursor, No Return Value
***
*** MHIDE() - Hides Mouse Cursor, No Return Value
***
*** MROW() - Returns Current Mouse Cursor Row (0-24),
***
*** MCOL() - Returns Current Mouse Cursor Column (0-79)
***
*** MLEFT() - Returns .T. if Button is Depressed
*** MRIGHT() .F. if Button is Released
*** MCENTER()
***
*** MTOPOS(<row>, <col>)
*** - Moves Mouse Cursor Position to Row, Col
***
*** MAREA(<uprow>, <upcol>, <lwrrow>, <lwrcol>)
*** - Limits Mouse Cursor Movement to Area Specified
***
*** NOTE: VERY IMPORTANT! - These functions do NO Error Checking
***
****************************************************************
* set up vars
single = "┌─┐│┘─└│" && box drawing characters
double = "╔═╗║╝═╚║"
store "" to string, laststring && keyboard input
store .F. to mbll, mbcl, mbrl, mbbl && Prime Last Button Press Info Holders
ctr = 0 && track passes in loop
**--> CHECK FOR MOUSE DRIVER
? "Checking For Mouse Driver..."
IF ! ISMOUSE()
? "Mouse Driver Not Found"
return
endif
?? "Present"
**--> RESET MOUSE DRIVER
? "Resetting Mouse Driver..."
if MRESET() = 0
? "Mouse Driver Not Active"
return
endif
* shut off Clipper cursor
set cursor off
* make screen
set color to W/N
clear
set color to N/W
@ 12,31,14,49 box single+" "
@ 13,38 say "QUIT"
set color to W/N
* set up status line
@ 0,0 say "Row:"
@ 0,10 say "Column:"
@ 1,0 say "Left Button:"
@ 1,30 say "Ctr Button:"
@ 1,59 say "Right Button:"
@ 24,0 say "Typed Text:"
* save base screen
save screen to mscrn
**--> DON'T ALLOW MOUSE CURSOR ON STATUS LINE, DISPLAY LIMIT BOX
MAREA(2,0,23,79)
@ 2,0,23,79 box double
**--> PLACE MOUSE CURSOR
MTOPOS(10,39)
**--> SHOW CURSOR
MSHOW()
do while .T.
* update & display counter
ctr = ctr+1
@ 0,69 say ctr
**--> GET MOUSE INFORMATION
mr = MROW()
mc = MCOL()
mbl = MLEFT()
mbc = MCENTER()
mbr = MRIGHT()
mbb = mbl .and. mbr && Status of Both Buttons Combined
* get keyboard key (if any)
xkey = inkey()
* display info
@ 0,4 say str(mr,2)
@ 0,17 say str(mc,2)
@ 1,12 say if(mbl,"Pressed ","Released")
@ 1,41 say if(mbc,"Pressed ","Released")
@ 1,72 say if(mbr,"Pressed ","Released")
if ! (string == laststring) && don't flicker
@ 24,11 say string + space(69-len(string))
laststring = string
endif
do case
case xkey > 31 && check for keyboard input
* built string from keyboard
string = string + chr(xkey)
loop
case xkey = 8 && backspace
string = left(string,len(string)-1)
loop
case (!mbb .and. mbbl) .or. xkey = 1 && both buttons released or Home Hit
if MR > 11 .and. MR <15 .and. MC > 30 .and. MC < 50
* both buttons released while in exit box
exit
endif
**--> HIDE MOUSE CURSOR WHEN RESTORING SCREEN
MHIDE()
restore screen from mscrn
@ 2,0,23,79 box double
MAREA(2,0,23,79)
MTOPOS(10,39)
MSHOW()
case (!mbl .and. mbll) .or. xkey = 19 && Left Button Released or Left Arrow Hit
MHIDE()
restore screen from mscrn
@ 2,0,23,39 box double
MAREA(2,0,23,39)
MTOPOS(12,20)
MSHOW()
case (!mbr .and. mbrl) .or. xkey = 4 && Right Button Released or Right Arrow Hit
MHIDE()
restore screen from mscrn
@ 2,40,23,79 box double
MAREA(2,40,23,79)
MTOPOS(12,60)
MSHOW()
case xkey = 27
exit
endcase
**--> Save Button Info For Next Pass
mbll = mbl
mbcl = mbc
mbrl = mbr
mbbl = mbb
enddo
**--> Turn Off Mouse Cursor, clean up screen
MHIDE()
* turn back on Clipper cursor, closeing screen
set cursor on
clear
? "Total Passes in Loop:",ctr
**--> CLEAR MOUSE DRIVER
MRESET()
RETURN
*** EOF