home *** CD-ROM | disk | FTP | other *** search
- (******************************************************************************
- * mouseTest *
- * This is a simple test program that shows if the mouse is functions, and *
- * demonstrates basic mouse programming using the mouseLib unit. *
- ******************************************************************************)
- program mouseTest;
-
- uses
- mouseLib
- ,Crt
- ,Graph
- ;
-
- var
- grdriver,
- grmode : integer;
-
- begin
- clrScr;
- if not (mouse_present) then begin
- { mouse_present was set by the mouseLib initialization code .. }
- write('mouse not installed');
- exit;
- end;
- case mouse_buttons of
- twoButton : writeLn('MicroSoft mouse Mode');
- threeButton : writeLn('PC mouse Mode');
- else writeLn('UnRecognized mouse mode');
- end; {case}
- writeln('MouseLib demo program, (c) 1992, Ron Loewy.');
- writeln;
- writeln('Move Cursor, Press Right & Left buttons together to continue');
- writeln(' Press any mouse button by itself to recognize');
- window(10, 7, 70, 20);
- hardwareTextCursor(10,13); { "normal" text cursor }
- showMouseCursor; { display the cursor }
- repeat
- if getButton(leftButton) = buttonDown then
- writeLn('Left Button Pressed');
- if getButton(rightButton) = buttonDown then
- writeLn('right Button Pressed');
- if getButton(middleButton) = buttonDown then
- writeLn('Middle Button Pressed');
- until (getButton(leftButton) = buttonDown) and
- (getButton(RightButton) = buttonDown);
- hideMouseCursor; { we hide the cursor }
- grDriver := detect;
- initGraph(grDriver, grMode, '');
- setMouseGraph; { fix quircks in Herc. graphic card }
- initMouse; { let the mouse sense it is in graphic mode }
- outTextXY(10, 10, 'MouseLib demo program, (c) 1992, Ron Loewy.');
- outTextXY(10, 30, 'Press the Middle Button to END');
- showMouseCursor; { draw the graphic default arrow cursor }
- repeat until getButton(middleButton) = buttonDown;
- hideMouseCursor;
- closeGraph;
- end.
-