Symbian
Symbian OS Library

FAQ-0507 Why does the Control not react to my simulated Ctrl-c, Ctrl-x, .... Events?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: EIKON
Created: 07/25/2000 Modified: 09/11/2002
Number: FAQ-0507
Platform: Not Applicable

Question:
I'm trying to emulate a Ctrl-c, Ctrl-x (events to initiate the cut, copy, paste, undo,etc) function of a control (example CEikEdwin).
I'm sending a TKeyEvent with a "c", "x", and the Ctrl-Modifier set to the control by calling the OfferKeyEventL-function of the control.The control does not seem to react correctly to my emulated key events. The only thing I get in my Edwin are the characters "c", "x". Why is the control ignoring my Modifier keys?


Answer:
The Control is not really ignoring your modifier keys, the Shortcut keys just work differently. The shortcut keys have their own event, and therefore are not initiated with the events you are sending to the control.
CoeDef.h defines a Macro CTRL(x), where x is the TEvent.iCode (e.g. 'c', 'x'). This can be used for translating the CtrlKey into the shortcut key. You just have to translate the iCode of your TKeyEvent. If you now send the translated TKeyEvent to the control by calling the control's OfferKeyEventL-function, the control should be able to recognize it correctly.