Symbian中的iScanCode和iCode
http://tech.ddvip.com 2008年09月08日 社区交流
内容摘要:我们知道在Symbian的按键事件处理中使用以下方法: TKeyResponse CMegajoyContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
我们知道在Symbian的按键事件处理中使用以下方法:
TKeyResponse CMegajoyContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
这个方法是在CCoeControl(Control base class from which all other controls are derived)中定义的虚函数,其定义如下:
OfferKeyEventL()virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
Description
Handles key events.
If a control wishes to process key events, it should implement this function. The implementation must ensure that the function returns
EKeyWasNotConsumed
if it does not do anything in response to a key event — otherwise, other controls or dialogs may be prevented from receiving the key event. If it is able to process the event it should return
EKeyWasConsumed
.
注释:
如果一个控件希望处理按键事件,那么它就应该实现这个函数。如果对一个按键事件,控件并没做任何事情,那么函数的实现中必须确保函数返回EKeyWasNotConsumed。否则,(控件栈中的)其它控件或对话框可能会接收不到按键事件。如果此控件能够处理按键事件,那么它应该返回EKeyWasConsumed。
When a key event occurs, the control framework calls this function for each control on the control stack, until one of them can process the key event (and returns
EKeyWasConsumed
).
注释:
当一个按键事件发生时,控件框架调用控件栈上的每个控件的OfferKeyEventL方法,直到它们中的一个能够处理这个按键事件(并且返回EKeyWasConsumed)。
来源:andy205214 作者:andy2052 责编:豆豆技术应用