MouseDownAndKeys
MouseDownAndKeys is a simple extension of the MouseEventsInViews
sample that shows how to specify that you want the mouse location in
local rather than global coordinates and how to find out what modifier
keys were down when you receive the mouse event.
Running the sample
Execute MouseDownAndKeysSApp. Click any mouse button in one of
the views. The view reports the location of the mouse click.
Files and classes
TMouseInputView is defined in MouseInputView.h and
MouseInputView.C. It is basically the same as the version in
MouseEventsInViews, except for two differences: 1) It calls
SetCoordinateView in HandleAfterConnectiontoViewRoot, passing a
TViewHandle on itself, to get the events reported in its own
coordinate system. 2) It queries the state of the keyboard
that corresponds to the current event by using a static member
function of TKeyboardInputDevice, GetDefaultKeyBoardInputDevice,
and asking the returned TKeyBoardInputDevice about its state.
Notes
There is at present no real way of associating input devices with
each other and, in particular, no real support for multiple devices of
the same kind. So the term "default" is a bit misleading--the device
returned is the only keyboard device, not one of many, or one that's
specifically associated with the mouse.
If you are writing new devices, follow the example set by the
keyboard and mouse devices, and define similar static member functions
that support this kind of query.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.