Mouse Events

The mouse input system provides functionality that enables you to manage mouse events from within a CommonPoint application.

MouseEventHandler

The MMouseEventHandler class is a mixin class; allowing you to add its functionality to any application. Three types of events that you will need to manage are:

Each of these events has a corresponding class which carries information about the event. For example, TMouseDownEvent objects carry information about mouse down events.

Using MMouseEventHandler

Using the mixin class is very easy. Simply inherit from MMouseEventHandler and override the appropriate member functions. Five functions you need to override are:

Tracking multiple clicks

It is not enough to be able to have your application handle a single mouse click. In many contexts, two or even three mouse clicks in rapid succession have meaning. Each TMouseDownEvent contains the number of clicks in the current grouping of mouse clicks--those which occurred within a preset time limit.

You can access this amount using the TMouseDownEvent::GetClickCount method. The GetClickCount member function returns the number of clicks so it is a simple matter to override the MMouseEventHandler::MouseDown method and compare the number of clicks found to the number that you are expecting.

The TMouseDownEvent holds the count of down clicks, and the TMouseUpEvent holds the count of up clicks. Both hold this click count for the most recent button pressed (to accommodate multibutton mice).

NOTE You should note that a double-click sequence is seen by an application as a series of two TMouseDownEvents. The first TMouseDownEvent object will return a click count of one. The second TMouseDownEvent will return a click count of two (the double click).


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker