TInteractors and mouse and keyboard events

Because TInteractors represent an alternative event distribution mechanism, you can use them to simplify mouse and keyboard interactions.

Interactors and keyboard event distribution

TInteractor objects can be bound to a specific input device. In the event that a TInteractor was bound to a keyboard input device, it would inherit behavior from the MKeyEventHandler class. Accordingly, it would be capable of handling keyboard events distributed to it through the TInteractor network.

Tracking mouse exits and entries with TInteractors

Using a TInteractor object to track mouse entries and exits is not very different from the normal event distribution mechanism.

Your TInteractor object must also inherit from MMouseEventHandler. Next, you should override the HandleActivate and HandleDeactivate methods of the TInteractor class to set the coordinate view. This determines the View to be watched. Finally, you should override the StartMouseEntryEvents and StopMouseEntryEvents methods to start and stop watching mouse entry events.

Because TInteractor objects are tied to a specific input device you do not need to worry about more than one mouse entering the View as you would with a more conventional arrangement.

NOTE TInteractor objects will only get mouse events from one input device at a time.

Tracking continuous mouse motion with TInteractors

Mix in MMouseEventHandler to the TInteractor object when you want to track mouse motion with the TInteractor. You will need to override the MouseDown, MouseUp, and MouseMoved methods if you want to track any sort of complex interaction associated with a View.

Remember to pass the handle of the View to SetCoordinateView in the HandleActivated method of the TInteractor object. You will also need to use the StartMouseMovedEvents method in the same override. When you are done with tracking mouse events, call the StopMouseMovedEvents method from the HandleDeactivate method.


[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