-
Declaration:
- Function DetectMouse:byte;
-
Description:
- DetectMouse detects whether a mouse is attached to the system or not. If there is no mouse,
then zero is returned. If a mouse is attached, then the number of mouse buttons is returned.
This function should be called after the mouse driver was initialized.
-
Errors:
- None.
-
See also:
- InitMouse (523),DoneMouse (505),
Listing: mouseex/ex1.pp
-
Declaration:
- Procedure DoneMouse;
-
Description:
- DoneMouse De-initializes the mouse driver. It cleans up any memory allocated when the
mouse was initialized, or removes possible mouse hooks from memory. The mouse functions
will not work after DoneMouse was called. If DoneMouse is called a second time, it will exit
at once. InitMouse should be called before DoneMouse can be called again.
-
Errors:
- None.
-
See also:
- DetectMouse (505), InitMouse (523)
For an example, see most other mouse functions.
-
Declaration:
- Function GetMouseButtons:word;
-
Description:
- GetMouseButtons returns the current button state of the mouse, i.e. it returns a or-ed
combination of the following constants:
-
MouseLeftButton
- When the left mouse button is held down.
-
MouseRightButton
- When the right mouse button is held down.
-
MouseMiddleButton
- When the middle mouse button is held down.
-
Errors:
- None.
-
See also:
- GetMouseEvent (507), GetMouseX (507), GetMouseY (508)
Listing: mouseex/ex2.pp
-
Declaration:
- Procedure GetMouseDriver(Var Driver : TMouseDriver);
-
Description:
- GetMouseDriver returns the currently set mouse driver. It can be used to retrieve the
current mouse driver, and override certain callbacks.
A more detailed explanation about getting and setting mouse drivers can be found in section
15.3, page 513.
-
Errors:
- None.
-
See also:
- SetMouseDriver (510)
For an example, see the section on writing a custom mouse driver, section 15.3, page
513
-
Declaration:
- Procedure GetMouseEvent(var MouseEvent:TMouseEvent);
-
Description:
- GetMouseEvent returns the next mouse event (a movement, button press or button release),
and waits for one if none is available in the queue.
Some mouse drivers can implement a mouse event queue which can hold multiple events till
they are fetched.; Others don’t, and in that case, a one-event queue is implemented for use
with PollMouseEvent (510).
-
Errors:
- None.
-
See also:
- GetMouseButtons (506), GetMouseX (507), GetMouseY (508)
-
Declaration:
- Function GetMouseX:word;
-
Description:
- GetMouseX returns the current X position of the mouse. X is measured in characters, starting
at 0 for the left side of the screen.
-
Errors:
- None.
-
See also:
- GetMouseButtons (506),GetMouseEvent (507), GetMouseY (508)
Listing: mouseex/ex4.pp
-
Declaration:
- Function GetMouseY:word;
-
Description:
- GetMouseY returns the current Y position of the mouse. Y is measured in characters, starting
at 0 for the top of the screen.
-
Errors:
- None.
-
See also:
- GetMouseButtons (506),GetMouseEvent (507), GetMouseX (507)
For an example, see GetMouseX (507)
-
Declaration:
- Procedure HideMouse;
-
Description:
- HideMouse hides the mouse cursor. This may or may not be implemented on all systems,
and depends on the driver.
-
Errors:
- None.
-
See also:
- ShowMouse (532)
Listing: mouseex/ex5.pp
-
Declaration:
- Procedure InitMouse;
-
Description:
- InitMouse Initializes the mouse driver. This will allocate any data structures needed for
the mouse to function. All mouse functions can be used after a call to InitMouse.
A call to InitMouse must always be followed by a call to DoneMouse (505) at program exit.
Failing to do so may leave the mouse in an unusable state, or may result in memory leaks.
-
Errors:
- None.
-
See also:
- DoneMouse (505), DetectMouse (505)
For an example, see most other functions.
-
Declaration:
- Function PollMouseEvent(var MouseEvent: TMouseEvent):boolean;
-
Description:
- PollMouseEvent checks whether a mouse event is available, and returns it in MouseEvent
if one is found. The function result is True in that case. If no mouse event is pending, the
function result is False, and the contents of MouseEvent is undefined.
Note that after a call to PollMouseEvent, the event should still be removed from the mouse
event queue with a call to GetMouseEvent.
-
Errors:
- None.
-
See also:
- GetMouseEvent (507), PutMouseEvent (510)
-
Declaration:
- Procedure PutMouseEvent(const MouseEvent: TMouseEvent);
-
Description:
- PutMouseEvent adds MouseEvent to the input queue. The next call to GetMouseEvent (507)
or PollMouseEvent will then return MouseEvent.
Please note that depending on the implementation the mouse event queue can hold only one
value.
-
Errors:
- None.
-
See also:
- GetMouseEvent (507), PollMouseEvent (510)
-
Declaration:
- Procedure SetMouseDriver(Const Driver : TMouseDriver);
-
Description:
- SetMouseDriver sets the mouse driver to Driver. This function should be called before
InitMouse (523) is called, or after DoneMouse is called. If it is called after the mouse has been
initialized, it does nothing.
For more information on setting the mouse driver, section 15.3, page 513.
-
Errors:
-
-
See also:
- InitMouse (523), DoneMouse (505), GetMouseDriver (506)
For an example, see section 15.3, page 513
-
Declaration:
- Procedure SetMouseXY(x,y:word);
-
Description:
- SetMouseXY places the mouse cursor on X,Y. X and Y are zero based character coordinates:
0,0 is the top-left corner of the screen, and the position is in character cells (i.e. not in
pixels).
-
Errors:
- None.
-
See also:
- GetMouseX (507), GetMouseY (508)
Listing: mouseex/ex7.pp
-
Declaration:
- Procedure ShowMouse;
-
Description:
- ShowMouse shows the mouse cursor if it was previously hidden. The capability to hide or
show the mouse cursor depends on the driver.
-
Errors:
- None.
-
See also:
- HideMouse (522)
For an example, see HideMouse (522)