How to change text of CBA buttons

Login to reply to this topic.
Thu, 2006-02-16 12:12
Joined: 2005-10-06
Forum posts: 13
when application starts i want text on the softkeys as

Option    open
&when user selelcts open means presses the softkey
then text on the softkeys should be

Pause     stop

Please suggest the .rss file& handeling the keys
Thanks in advance
Regards,
Meghana

Fri, 2006-02-17 05:49
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: How to change text of CBA buttons
In the RSS file:

Code:
RESOURCE CBA r_yourapp_softkeys_options_open
{
buttons =
{
CBA_BUTTON { id=EAknSoftkeyOptions; txt = "Options"; },
CBA_BUTTON { id=EYourAppCmdOpenApp; txt = "Open"; }
};
}

RESOURCE CBA r_yourapp_softkeys_options_stop
{
buttons =
{
CBA_BUTTON { id=EAknSoftkeyOptions; txt = "Options"; },
CBA_BUTTON { id=EYourAppCmdStopApp; txt = "Stop"; }
};
}

In the HRH file:

Code:
enum TYourAppCommandIds
    {
// ...
id=EYourAppCmdOpenApp,
id=EYourAppCmdStopApp,
// ...
};

In your application's AppUi class:

Code:
void CYourAppUi::SetCommandSetL(TInt aResourceId)
{
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
cba->SetCommandSetL( aResourceId );
}

Now you can call:

SetCommandSetL( R_YOURAPP_SOFTKEYS_OPTIONS_OPEN );
OR
SetCommandSetL( R_YOURAPP_SOFTKEYS_OPTIONS_STOP );

where ever you want.  Roll Eyes

Mon, 2006-02-20 06:50
Joined: 2005-10-06
Forum posts: 13
Re: How to change text of CBA buttons
Thanks a lot for ur help.
Ur code works.

Regards,
Meghana
Sat, 2008-09-27 14:53
Joined: 2007-05-15
Forum posts: 137
Re: How to change text of CBA buttons

I followed the link
http://wiki.forum.nokia.com/index.ph...n_button_group

and made modification to the code.

Still.. I get panic user 23

MODIFIED CODE
---------------
.rss file
-----------
RESOURCE CBA r_hello_bye
{

buttons ={

CBA_BUTTON {id = EHello;txt = "hello";},
CBA_BUTTON {id = EBye;txt = "Bye"; }
};
}

RESOURCE EIK_APP_INFO
{
menubar = r_menubar;
cba =R_AVKON_SOFTKEYS_OPTIONS_EXIT;
}

APPui.cpp file
----------------
#include

void CTRM_SymbAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
-------------------------
-------------------------
case EGpsMap:
{

CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
if(cba)
{
cba->SetCommandSetL(R_HELLO_BYE);
cba->DrawNow();
}

iAppView->GetGpsInfoL();
}
break;

----------------------------
----------------------------

}}

in mmp file
-------------
eikcoctl.lib avkon.lib
now what to do.......

Fri, 2008-10-03 10:49
Joined: 2007-05-15
Forum posts: 137
Re: How to change text of CBA buttons

I followed ur posts. It works now.
I dont know why it was not working earlier.
But, there is still another problem.......
I need to add a menu_bar to the open button in the softkey----- r_yourapp_softkeys_options_open

Regards!

Tue, 2008-10-28 17:06
Joined: 2007-05-15
Forum posts: 137
Re: How to change text of CBA buttons

solved using
iEikonEnv->AppUiFactory()->MenuBar()->TryDisplayMenuBarL();

your posts were usefull
Thanks

Tue, 2008-10-28 17:11
Joined: 2007-05-15
Forum posts: 137
Re: How to change text of CBA buttons

I guess the error in the previous try to change CBA was because it was defined above

RESOURCE EIK_APP_INFO
{
menubar = r_menubar;
cba =R_AVKON_SOFTKEYS_OPTIONS_EXIT;
}

Still now if I define my code above RESOURCE EIK_APP_INFO, it gives some panic
it works if the code is defined below.

This is just my guess.

This data may be helpfull to someone else

Regards to all!

  • Login to reply to this topic.