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:
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.
You can construct and destruct objects of this class. You cannot copy or assign objects of this class.
![]() |
public:
virtual ~IKeyboardConnectionTo()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IKeyboardConnectionTo( ATarget& target, KeyboardMemberFn characterKeyMemberFn )
Constructs the IKeyboardConnectionTo object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members are overridden to route virtual and character key press events to the target object provided on construction.
![]() |
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.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
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.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to register functions on the target object to receive keyboard events.
![]() |
public:
IKeyboardConnectionTo < ATarget >& setVirtualKeyMemberFn( KeyboardMemberFn virtualKeyMemberFn )
Sets the function to process virtual key press events.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
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.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
virtual ~IHandler()
virtual IString asDebugInfo() const
virtual IString asString() const
virtual IHandler& disable()
virtual IHandler& enable(bool enable = true)
virtual IHandler& handleEventsFor(IWindow* window)
IHandler()
bool isEnabled() const
virtual IHandler& stopHandlingEventsFor(IWindow* window)
virtual ~IKeyboardHandler()
IKeyboardHandler()
virtual IEventResult defaultProcedure(IEvent& event)
virtual bool dispatchHandlerEvent(IEvent& event) = 0
virtual bool dispatchHandlerEvent(IEvent& event)
virtual bool key(IKeyboardEvent& event)
virtual bool scanCodeKeyPress(IKeyboardEvent& event)