MouseMoved Events

MouseMovedEvents is a sample that illustrates how to use MouseMoved together with StartMouseMovedEvents to track the location of a mouse in a view. It starts tracking the mouse location when the mouse enters the view and stops tracking when it leaves the view. Mouse-moved events are not reported automatically for all MMouseEventHandlers, because of the overhead.

Running the sample

Execute MouseMovedEventsSApp. Move the mouse over the views. The view under the mouse will report the mouse location in its local coordinate system. To quit, click Close.

Files and classes

TMouseInputView is defined in MouseInputView.h and MouseInputView.C. It is basically the same as the version in MouseEventsInViews, except that 1) it calls SetCoordinateView after registering with the event receiver, to indicate the view for which entry and exit reports should be reported; 2) it calls StartMouseEntryEvents in order to be informed when the mouse enters or leaves the view; and 3) it calls StartMouseMovedEvents and StopMouseMovedEvents when a mouse enters and leaves the view.

Notes

To receive mouse-moved events you must call StartMouseMovedEvents passing the mouse device you wish to track. Often you will get this device via an event passed to MouseEntered, as implemented in this sample.

The input system does not currently support multiple mice, so the code included in this sample to support multiple mice is not actually exercised.


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