Hi !
I have the following code
Code:
TKeyResponse CAppInBackgroundContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if ( aKeyEvent.iCode== EKeyYes )
{
iEikonEnv->AlertWin (_L("keycaptured"));
return EKeyWasConsumed;
}
return EKeyWasNotConsumed;
iLog.Write(_L("### OfferKeyEventL called ###")); //Log this call
}
And the ConstructL is as follows
Code:
void CAppInBackgroundContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
InitComponentsL();
ActivateL();
User::LeaveIfError(iLog.Connect());
iLog.CreateLog(_L("AppInBackground"),_L("AppInBackgroundLog"), EFileLoggingModeOverwrite);
iLog.Write(_L("### ConstructL(const TRect& aRect) = 1 ###"));
iEikonEnv->RootWin().CaptureKey( EKeyYes, 0, 0 );
iEikonEnv->RootWin().CaptureKeyUpAndDowns( EKeyYes, 0, 0 );
}
It appears from the log that OfferKeyEventL() gets called immediately after ConstructL() and not when any key is pressed while the application is in the background.
I tried replacing EkeyYes with EKeyDial and even that didnt work. Could you plz tell me what am I doing wrong ?
Thank you :-)