About TMouse

Submitted on: 1/1/2015 12:56:00 AM
By: Emiel Hollander (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: Delphi 5, Delphi 4, Pre Delphi 4
Views: 3951
     The global object Mouse, which is of type TMouse, contains information about the mouse. The object Mouse has several properties and one method I'll discuss here. For more properties and methods look in the Delphi help file, I will only discuss one method that is only present in TMouse, and not the methods that are derived from TObject.


But first the properties. To find out if there actually is a mouse present on the system, use the property MousePresent.

You can use the property Capture to find out which window is currently capturing the mouse events. This property returns a handle, that you can use to find out further information about the window. The property is defined like this: Property Capture: HWND;

The property CursorPos returns a TPoint and contains the position of the mouse cursor. You can use Mouse.CursorPos.X and Mouse.CursorPos.Y to find out the exact position of the mouse cursor.

DragImmediate specifies if clicking the mouse button starts a drag event immediately, or of drag events are delayed until the mouse has moved the number of pixels specified in the DragTreshold property.

Use DragThreshold to specify the number of pixels that the mouse cursor must be moved with the left mouse button down in order to cause a drag event.

The property WheelPresent returns a boolean and specifies whether the mouse has a wheel.

Use the property WheelScrollLines, which returns an integer, to see how many lines are scrolled if someone turns the mouse wheel.

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.