IKeyboardConnectionTo

The IKeyboardConnectionTo class is a template class, derived from IKeyboardHandler, that processes keyboard events. This class allows you to process characterKeyPress and virtualKeyPress keyboard events in objects that do not derive from IKeyboardHandler without having to manually derive from IKeyboardHandler, override the characterKeyPress and virtualKeyPress functions, and pass the events to the object.

To use the IKeyboardConnectionTo class to process characterKeyPress events, follow these steps:

  1. Instantiate the IKeyboardConnectionTo template with a class containing a member function whose signature and behavior are the same as IKeyboardHandler::characterKeyPress.
  2. Construct an object of the new template class by passing the object and the address of the member function handling the keyboard events.
  3. Attach the template keyboard handler by using IHandler::handleEventsFor to pass the appropriate window to the keyboard handler.

You can additionally process virtualKeyPress events by calling the setVirtualKeyMember function with the address of a function that contains the same signature and behavior as IKeyboardHandler::virtualKeyPress. To process only virtualKeyPress events, pass a null value for the address of the member function on the IKeyboardConnectionTo constructor.

You use an IKeyboardConnectionTo object anywhere you use an IKeyboardHandler object. See the class description of IKeyboardHandler for a description of the uses and limitations of these classes.


IKeyboardConnectionTo - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class. You cannot copy or assign objects of this class.


[view class]
~IKeyboardConnectionTo
public:
virtual ~IKeyboardConnectionTo()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IKeyboardConnectionTo
public:
IKeyboardConnectionTo( ATarget& target, KeyboardMemberFn characterKeyMemberFn )

Constructs the IKeyboardConnectionTo object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Event Processing

These members are overridden to route virtual and character key press events to the target object provided on construction.


[view class]
characterKeyPress
protected:
virtual bool characterKeyPress(IKeyboardEvent& event)

Overridden to route character key press events to the characterKeyMemberFn function of the target object that you specified when constructing the handler. This function returns false if you did not provide a characterKeyMemberFn function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
virtualKeyPress
protected:
virtual bool virtualKeyPress(IKeyboardEvent& event)

Overridden to route virtual key press events to the virtualKeyMemberFn function of the target object if you provided one by calling setVirtualKeyMemberFn.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Function Registration

Use these members to register functions on the target object to receive keyboard events.


[view class]
setVirtualKeyMemberFn
public:
IKeyboardConnectionTo < ATarget >& setVirtualKeyMemberFn( KeyboardMemberFn virtualKeyMemberFn )

Sets the function to process virtual key press events.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IKeyboardConnectionTo - Type Definitions


[view class]
KeyboardMemberFn
typedef bool (ATarget::*KeyboardMemberFn)(IKeyboardEvent&)

A pointer to a member function of class ATarget that takes a reference to an IKeyboardEvent and returns a bool.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IKeyboardConnectionTo - Inherited Member Functions and Data

Inherited Public Functions

IHandler
IKeyboardHandler

Inherited Public Data

Inherited Protected Functions

IHandler
IKeyboardHandler

Inherited Protected Data