I'm relatively new to Symbian, and for the past several days have been pouring over the API relating to multiple resource files. Specifically I wanted to dynamically set a menu bar located in a second resource file. I managed to get that working using the following statements:
/* Add the second resource file */
TInt offset = CEikonEnv::Static()->AddResourceFileL( resourceFullName );
/* Set the menu */
CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
menuBar->SetMenuTitleResourceId( R_MENUBAR_ID );
/* Delete the second resource file */
CEikonEnv::Static()->DeleteResourceFile( offset );
So far so good. My next step was to attempt to use a CBA resource defined in the same 2nd resource file. I placed the following statement after the call to SetMenuTitleResourceId().
/* Set the CBA */
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
cba->SetCommandSetL( R_CBA_ID );
For some reason the call to SetCommandSetL() results in a Panic CONE 14 (no resource found). And if I put the CBA resource into the main resource file the statement works as expected. I'm surprized by this, since the call to SetMenuTitleResourceId() seems to work properly with the second resource file. Is there any reason that CBA resources would be treated differently than MENU_BAR resources with respect to added resource files?
Any help would be appreciated.