Dec 122017
 
Mouser! enables the Turbo Pascal Programmer to utilize the existence of a MS or Compatible Mouse. TP 5.5 and 6.0 TPU only.
File MOUSER!6.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Mouser! enables the Turbo Pascal Programmer to utilize the existence of a MS or Compatible Mouse. TP 5.5 and 6.0 TPU only.
File Name File Size Zip Size Zip Type
MOUSER!.DOC 17688 5571 deflated
MOUSER60.TPU 6848 2869 deflated
MOUSER55.TPU 6736 2857 deflated
REGISTER.FRM 1435 710 deflated
TEXTDEMO.EXE 13136 6939 deflated
VGADEMO.EXE 92128 48674 deflated
DEMO1.PAS 2889 1081 deflated
DEMO2.PAS 1736 727 deflated
DEMO3.PAS 1235 433 deflated
DEMO4.PAS 2219 845 deflated

Download File MOUSER!6.ZIP Here

Contents of the MOUSER!.DOC file


*********************************************************************

Mouser!

*********************************************************************


A unit for Turbo Pascal Programmers versions 5.5 & 6.0!
(c) Copyright 1991-2, Daniel Dioguardi
All Rights Reserved




Mouser! enables the Turbo Pascal Programmer to utilize the existence
of a MS or Compatible Mouse. Mouser! is a unit that gives the
programmer numerous new functions and procedures to utilize by
simply calling them from his program.

The programmer is able to activate the mouse, change the
shape of the mouse pointer, position it, obtain the current
position of it, find out where a button was pressed, where
it was released, which button was pressed, etc. Mouser!
can add a whole new dimension to your programs!




This is a Demonstration copy of Mouser!. The TPUs provided within
this archive are LIMITED versions and lack many of the features of
the REGISTERED version. The REGISTERED version of Mouser! contains:

o Latest Full Mouser! Version
o Documented Source Code for Mouser!
o Documented Source Code for TEXTdemo demo
o Documented Source Code for VGAdemo demo
o Additional Pointer Shapes
o Additional Features
o Technical Support
o DEMO Copy of BatchBuddy - a program that lets you easily
add WINDOWS, COLOR, SCROLLING,
music, etc. to your BATCH FILES!

To obtain the REGISTERED version of Mouser! with all of these extras,
please send $10 to:

Daniel Dioguardi
1201 W Esplanade #705
Kenner, LA 70065
RE: Mouser! Registration

As this is not my home address please allow an extra week for your
request to be forwarded to me.




(********************************************************************)

Mouser! Documentation

(********************************************************************)



The Mouser diskette contains the following files:

Mouser55.TPU <----- Compiled UNREGISTERED Mouser! UNIT for TP5.5
Mouser60.TPU <----- Compiled UNREGISTERED Mouser! UNIT for TP6.0
Mouser!.DOC <----- This file
Textdemo.EXE <----- Text Screen Demo of Mouser! capabilities
VGAdemo.EXE <----- VGA Demo of Mouser! capabilities
REGISTER.FRM <----- Easy way to REGISTER

To use the units, you must do the following:

If you are using Turbo Pascal v5.5, simply put Mouser55 in your
USES statement in your programs. If you are using Turbo Pascal
6.0, use Mouser60 instead of Mouser55.


GLOBAL VARIABLES:

MouseX : Integer;
Shows the mouse's X position after update call

MouseY : Integer;
Shows the mouse's Y position after update call

PressedMouseX : Integer;
Shows X position where mouse button was pressed

PressedMouseY : Integer;
Shows Y position where mouse button was pressed

ReleasedMouseX : Integer;
Shows X position where mouse button was released

ReleasedMouseY : Integer;
Shows Y position where mouse button was released

NOTE: One peculiarity of mouse programming is that the position
of the mouse cursor will be reported in a slightly different
format. The screen is still 24 by 80, but all of the numbers
concerning position to and from the mouse will be functions
of the actual screen coordinates. This is because the mouse
driver sees a cursor as pixels instead of one contiguous block.

See what I mean? So if you receive 56,80 as the Mouse's
position in 80 column text mode, it really means 7,10.

8 x 7 = 56
8 x 10 = 80


In CGA, and EGA in low resolution modes, 640 x 200, 0,0 is
the upper left pixel. In high resolution mode, 640 x 200,
there is a 1:1 ratio of pixels to Mouser! coordinates. In
other graphics and text modes the coordinates of each pixel
or character increment by 2, 8 or 16.

In medium resolution graphics mode, 320 x 200, each horizontal
pixel is mapped onto an even coordinate. In this case, the
coordinates across the top line are (0,0), (2,0), (4,0), etc.

For Hercules Graphics, 720 x 348, (0,0) is the upper left
pixel, and there is a 1:1 ratio of pixels to mouse pixels.

In 80 x 25 text mode each character is 8 pixels in each
direction. Across the top line character coordinates are
(0,0) (8,0) etc. The lowest Y value is 192 in this mode.
In 40 x 25 text mode each character 16 pixels wide and 8
pixels high. So the Equivalent of 10,10 would be 176,88 in
mouse coordinates.

For the Enhanced Graphics Adapter in High Resolution Modes -
640 x 350, (0,0) is the upper left pixel, and there is a 1:1
ratio.


MouseButton : Word;
Indicates which mouse button was last activated
Constants LeftB, RightB, and MiddleB are used
by Mouser! to depict a 1, 2, or 3. These
Constants are global and may be used in the
main body of your programs while using Mouser!

NumberofButtons : Word;
Indicates number of buttons on the mouse in use,
by showing a 2 for a two or three buttoned mouse,
10 if there is no mouse present, and zero for
other combinations of buttons(i.e. 1 button, etc.)
This variable can not be SET to show a certain
type of mouse, it is DETERMINED internally by
Mouser! Registering to obtain the source code
will allow you to customize this peculiarity
to your own specifications if it is in conflict
with your particular setup.

Installed : Boolean;
This variable is also determined by Mouser! in the
initialization process. It is TRUE if there is a
MS Mouse or compatible mouse driver present.
Installed MAY BE FORCED ON, in order to force
Mouser! to recognize a driver if need be.

Showing : Boolean;
This variable is used internally by Mouser! to
indicate if Mouse cursor is hidden or not at the
time. You can use it for the same purpose. It
will be updated when you make a call to Hide or
Show the cursor.

NOTICE: Many of the variables used in Mouser! were declared Globally
in order to afford the programmer the greatest amount of control
over the workings of your project. Also, OOP techniques were
avoided in order to retain compatibility with the many
programmers who are using Turbo Pascal 5.0. Programmers
who use TP5.0 may use Mouser! if they REGISTER, as the
REGISTERED version contains code that is compatible with
TP5.0.



PROCEDURE Blip;
- Mouser! uses this procedure to call your attention to any errors
that may occur concerning driver status, etc. But you may use it
to sound a short blip of noise if you like. If you register, you
can put in your own error handling routines.

example

IF NOT Installed THEN Blip;



PROCEDURE ShowMouse;
- Activates the Mouse Cursor so you can see it on the screen.
Certain commands inherently turn off the mouse cursor when they
execute, so you can use this command to unhide it.
NOTE: During writes to the screen, if the mouse cursor is in the
location of the update it will distort the character's color
or shape. In order to avoid this, you can reposition the
mouse cursor with the function PutMouseXY, or hide the mouse
cursor, write to the screen, and then unhide it. THE LATTER
METHOD IS USUALLY MOST APPROPRIATE. The user should not be
able to notice the cursor disappear if the update to the screen
does not take too long.

example

ShowMouse;


PROCEDURE HideMouse;
- This procedure makes the mouse cursor disappear, though it is really
still there. Many calls to hide the cursor will require you to
call ShowCursor many times to unhide it!

example

IF Ending THEN
BEGIN
HideMouse;
HALT(1);
END;


PROCEDURE GetMXY;
- This procedure Updates the Variables MouseX and MouseY. Remember,
however, to divide them by eight for text mode in order to make the
numbers similar to regular text mode positioning.

example

GetMXY;
IF MouseX>(20*8) THEN Blip; { if MouseX>20 is text mode equivalent }



FUNCTION ButtonPressed: Boolean;
- This procedure is a real handy one to have around! It returns TRUE
if a button is being pressed. If you need to see if a specific
button is being pressed, use one of the three following functions.

example

MouseStat;
IF ButtonPressed THEN
REPEAT UNTIL NOT ButtonPressed;
MouseStat;
Writeln('Mouse pressed at ',PressedMouseX,',',PressedMouseY);
Writeln('Released at ',ReleasedMouseX,',',ReleasedMouseY);


FUNCTION LButtonPressed: Boolean;
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- Like ButtonPressed, except that it return TRUE only if the Left
mouse button is being pressed.

FUNCTION RButtonPressed: Boolean;
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- Returns true if the Right mouse button is being pressed.

FUNCTION MButtonPressed: Boolean;
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- Returns TRUE if the Middle mouse button (if any) is being pressed.


PROCEDURE MouseStat;
- This procedure updates many variables concerning which button, if
any, is being pressed, where the button was pressed:
PressedMouseX and PressedMouseY

where the button was last released at:
ReleasedMouseX and ReleasedMouseY

and what the current mouse position is:
MouseX and MouseY

REMEMBER that a computer is fast, so fast that when a button has
been pressed, the procedure is finished BEFORE the user
RELEASES the button! So if you need to know not only where
the button was pressed, but also where the button was released,
you must do these two things:

REPEAT
.
..whatever to do while the user is releasing the button
.
UNTIL NOT ButtonPressed;
MouseStat;

The second call to mousestat will contain the appropriate
values in ReleasedMouseX and ReleasedMouseY because now the
button has been released.


PROCEDURE PutMouseXY(MouseX, MouseY: Integer);
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- This procedure lets you pass an X and a Y to position the mouse
where you want it. REMEMBER to pass it coordinates that have
been multiplied by 8 if you are in 80 column text mode.

example

Window(1,10,5,15,Blue,Red);
PutMouseXY(5*8,10*8);



PROCEDURE MouseHRange(MouseHMin, MouseHMax: Integer);
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- If you need to confine the mouse cursor to any specific horizontal
region of the screen you must use this function.

example

Window(1,10,5,15,Blue,Red);
MouseHRange(1*8,5*10);
MouseVRange(10*8,15*8);



PROCEDURE MouseVRange(MouseVMin, MouseVMax: Integer);
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- This is the same as MouseHRange, only this confines the mouse
vertically.

example

Window(1,10,5,15,Blue,Red);
MouseHRange(1*8,5*10);
MouseVRange(10*8,15*8);



PROCEDURE DefineTCursor(CursorChoice: Integer);
- You can make the Text cursor any one of over 200 characters by
passing the character's ASCII number to this procedure. My
favorites are: 177, 178, 219, 254, and 249.

example
DefineMouseCursor(177);



PROCEDURE DefineGCursor(Cursortype);
- This function lets you choose from predefined shapes for
your mouse pointer in Graphics mode ONLY. You can choose from
the following simply by placing their data points into the Mouser
code under the CONST heading. **** Some of the data sets are in the
code already, the others are for the REGISTERED VERSION ONLY. ****

Arrow IBeam
Crosshairs Check
Man LFTArrow
RtArrow Glove
Sight Wires
Eyes Block1
Block2 Block3
Block4 Boxdraw
Circle Croshair
Face1 Finger
Ghsteyes Groucho
Linitup Myarrow
Pencil Thefingr
UpArrow Yes
Lineup


You can use these shapes while in graphics mode by simply
passing the appropriate name to the PROCEDURE. To create
your own cursor shapes consult the DOC file included with
the REGISTERED version of Mouser!

FUNCTION DisplayPage: Integer;
- This tells you what display page the cursor is on.
It returns as a negative number if there is an error.

example
ActivePage:= DisplayPage;


PROCEDURE SetDisplayPage(Page: Integer);
- This procedure allows you to place the mouse cursor on any logical
page

example

SetDisplayPage(ActivePage);



FUNCTION MouseLanguage: Integer;
- This function returns a number that represents the language that
the mouse is running under, letting you choose the language of
your messages accordingly.

Codes are as follows:

0 - English
1 - French
2 - Dutch
3 - German
4 - Swedish
5 - Finish
6 - Spanish
7 - Portuguese
8 - Italian

NOTE: If a US driver is being used then this call will be ignored.

example

IF MouseLanguage=6 THEN Write('Hola!');



PROCEDURE SetMouseLanguage(Language: Integer);
- This lets you choose what language to run the driver under. US
Drivers will ignore this call as it is only for international
versions. Pass the same numbers as returned from MouseLanguage.

example
SetMouseLanguage(2);


PROCEDURE HitIn(X1, Y1, X2, Y2): Boolean;
- This procedure makes life real easy. You can pass the Mouser! coordinates of
any are of the screen, and it will return true if a mouse button is being
pressed in that area. You can create 'buttons' on the screen, and easily
detect when a mouse 'hit' occurs on the button.

example

IF HitIn(225,100,285,120) THEN Blip;

PROCEDURE HitInL(X1, Y1, X2, Y2): Boolean;
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- Same as above but only returns true if the LEFT Mouse button was pressed
inside the coordinates.

PROCEDURE HitInR(X1, Y1, X2, Y2): Boolean;
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- Same as above but only returns true if the RIGHT Mouse button was pressed
inside the coordinates.

PROCEDURE HitInM(X1, Y1, X2, Y2): Boolean;
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
(***** REGISTERED VERSION ONLY *****)
- Same as above but only returns true if the MIDDLE Mouse button was pressed
inside the coordinates.


***************************************************************************
DISCLAIMER: To the best of my knowledge, Mouser! works as described above
and will cause no damage to you or any system that it operates
on. However, I make no guarantees as to it's functioning in
your particular system or in your particular program. I am
also not responsible for any loss, fire, flood, damage, or
hardship that results from the use or misuse of Mouser! or
any of the accompanying files. The user of these files
assumes full risk for using them. No warranty is stated
or implied.


Turbo Pascal is a registered trademark of Borland International, Inc.






 December 12, 2017  Add comments

Leave a Reply