Creating the interactor
TMoveInteractor derives from the Input system class TInteractor, which provides protocol for converting user events into specific actions, and mixes in MMouseEventHandler to include the ability to receive and handle mouse events.
To handle the interaction, TMoveInteractor overrides the MMouseEventHandler functions MouseDown, MouseMoved, and MouseUp:
- MouseDown calls StartMouseMovedEvents to start tracking for mouse movement within the view (MouseMoved handling)--mouse tracking is usually turned off to keep it from slowing performance unnecessarily.
MouseDown also calls StartMouseEntryEvents to track movement of the mouse in and out of the window. When the mouse moves out of the window, MouseMoved handling is turned off to prevent a user from dragging a tile outside the window. MouseMoved handling is turned back on when the mouse re-enters the window.
- MouseMoved creates the TMoveCommand/TTilesSelection pair and executes the command incrementally as the mouse is moved.
- MouseUp stops mouse tracking by calling StopMouseMovedEvents and StopMouseEntryEvents, and turns the command binding over to the document to complete execution. MouseUp sets a flag indicating that this interaction is finished.
A specific view creates a given instance of TMoveInteractor to handle interaction only within that view. Do not use this interactor for any following mouse events--create a new one.
TMoveInteractor also overrides the MMouseEventHandler functions MouseEntered and MouseExited, the functions called when the user moves the mouse in and out of the view.
This figure shows the protocols overridden by TMoveInteractor:
You can now create a Tiles document and see the new functionality by compiling the project in the directory $TaligentRoot/TaligentSamples/Supported/Apps/TilesTutorial/06.MouseInteraction/
Tiles
and then calling TilesTutorialApp
from the $TaligentSharedLibs
directory. Make sure that a previous version of a Tiles document is not running when you compile the project.
[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