views:

1021

answers:

5

Hi

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!

+2  A: 

Are you handling (in your appui::HandleCommandL) command ids EEikCmdExit and EAknSoftkeyExit?

 if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
  {
  Exit();
  }
Kasprzol
+1  A: 

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();
        }
     }
}
ayaz
A: 

Yes, my HandleCommandL method has the logic to exit. However the application does not respond.

Could there be something I have messed with in the UI Designer...

Thanks

adam
+1  A: 

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?

Kasprzol
+1  A: 

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 :)

adam