S60 application - Symbian C++ - Exit button doesn't work
Question
In my Symbian S60 application, my Options menu works as expected. But the Exit button does nothing.
I am developing with Carbide and have used the UI Designer to add items to the options menu.
Does anyone know how to enable the exit button, or why else it might not work?
Thanks!
Solution
Are you handling (in your appui::HandleCommandL
) command ids EEikCmdExit
and EAknSoftkeyExit?
if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
{
Exit();
}
OTHER TIPS
Have you looked inside the HandleCommandL( TInt aCommand )
method of the AppUi
class of your application? For example, in all UI projects I create with Carbide, the following is automatically present inside the HandleCommandL()
method:
void MyAppUi::HandleCommandL( TInt aCommand )
{
TBool commandHandled = False;
switch ( aCommand )
{
default:
break;
}
if ( !commandHandled )
{
if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
{
Exit();
}
}
}
What CBA resource (softkey buttons layour) are you using? R_AVKON_OPTIONS_EXIT
? are you handling the the exit commands in any other way? or are you traping the Exit()
call? Are you even receiving the the EEikCmdExit
code? If you have the commandHandled
boolean, is it set to EFalse
?
Commands were being handled in my main view
So I changed it to this...
void CMyContainerView::HandleCommandL( TInt aCommand )
{
TBool commandHandled = EFalse;
switch ( aCommand )
{
// ...
default:
break;
}
if ( !commandHandled )
{
AppUi()->HandleCommandL(aCommand);
}
}
Thanks all :)