HandleKeyEventL not hiting
| Mon, 2006-10-30 20:59 | |
|
Hi All,
 I am getting strange problem in my project. I overloaded HandleWsEventL(), HandleKeyEventL() and OfferKeyEventL(). Whenever I press any key event, focus is coming to HandleWsEventL() and it calls OfferKeyEventL(). The problem is eventhough I am not consuming the key event in OfferKeyEventL(), my function HandleKeyEventL() is not getting called. Can anyone help me where I have done wrong. Thanks in advance... mos |
|






Forum posts: 732
Which class did you derive your class? Please give more details.
Forum posts: 35
My appui class is derived from CAknViewAppUi while I have my view and container classes separately.
class CMyAppUi : public CAknViewAppUi
{
public:
void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination);
TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
};
class CMyView : public CAknView
{
};
class CMyContainer : public CCoeControl, MCoeControlObserver
{
public: // From CoeControl
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType );
};
Thanks in advance.
mos
Forum posts: 732
It says:
Handles events sent to the application by the window server.
This function is called whenever the window server sends key or pointer events or some other special events to the application. It calls one of a number of functions, according to the type of event.
For key events, it calls CCoeControl::OfferKeyEventL() for each control on the control stack, beginning with the control at the top (position 0) until a control consumes it. If no control on the stack consumes the key event, the app UI's HandleKeyEventL() is called. Note that CCoeControl::OfferKeyEventL() is not called for controls whose ECoeStackFlagRefusesAllKeys flag is set.
...
...
Forum posts: 108
As per document says, It is not recommenened to override
HandleKeyEventL() in derived class.
If you intended to override this function, you should also override InputCapabilities() virtual function, returning a TCoeInputCapabilities object whose attributes correspond to the behavior of the HandleKeyEventL() function.
In the implementation of HandleWsEventL function , Pass the key event to window server.
CEikAppUi::HandleWsEventL(aEvent,aDestination);
May be it solves your problem.
DipakBaviskar
Forum posts: 35
As SDK documents says:
>>For key events, it calls CCoeControl::OfferKeyEventL() for each >>control on the control stack, beginning with the control at the top >>(position 0) until a control consumes it. If no control on the stack >>consumes the key event, the app UI's HandleKeyEventL() is >>called.
I am also doing the same thing. I am not consuming the KeyEvent in my OfferKeyEventL(), as per document it should call my HandleKeyEventL().
TKeyResponse CMyContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType )
{
if(aKeyEvent.iScanCode == 56) // When I press 't'
return EKeyWasNotConsumed;
}
Thanks
mos
Forum posts: 732
Forum posts: 35
yes, I created Listbox in my contianer class and also override method HandleListBoxEventL() in my container class.
Thanks
mos
Forum posts: 35
I override InputCapabilities() in my AppUi class but still focus is not coming in my HandleKeyEventL() function when I press any key and not comsuming key event anywhere.
TCoeInputCapabilities CMyAppUi::InputCapabilities() const
{
return (TCoeInputCapabilities::EAllText | TCoeInputCapabilities::ENavigation);
}
Thanks
mos
Forum posts: 35
Just want to add one more point.
My application is based on SMS. So, once I click my application icon, the focus comes to HandleKeyEventL() through HandleWsEventL(); but after receiveing the Loggin message from the server(running on differrent system) the focus is not coming to my HandleKeyEventL().
thanks
mos
Forum posts: 732
{
   if(aKeyEvent.iScanCode == 56) // When I press 't'
    return EKeyWasNotConsumed;
}
...
For which device are you developing the application?
Forum posts: 35
I am developing for 6600,6630 and I am using version 7 series60 2nd edition. I can consumed the key event in OfferKeyEventL() but in my application I have 10 views. So, for hotkey I want to make my code generic so that I can consume hotkey event in HandleKeyEventL() instead of consuming in OfferKeyEventL of all the containers.
Thanks
mos
Forum posts: 13
Hi
i am new to symbian os so any body will help me to write a program that will display a message when i pressed a key ..
PLZ reply ASAP