Changing softkeys dynamically and disabling them in Symbian
Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition
S60 3rd Edition
S60 2nd Edition
S60 3rd Edition
Article
Created: User:Technical writer 2
(17 Aug 2007)
Last edited: hamishwillee
(14 Jun 2012)
Overview
This article shows how to change and disable softkeys dynamically in Symbian C++.
Description
Softkeys can be changed dynamically in the following way:
Define a new CBA resource (or resources) in the .rss file
RESOURCE CBA r_custom_cba1
{
buttons =
{
CBA_BUTTON { id = ECba1Button1; txt = "Button1"; },
CBA_BUTTON { id = ECba1Button2; txt = "Button2"; }
};
}
Add definitions for new command IDs to the .hrh file:
enum TMyMenuCmdIDs
{
ECba1Button1,
ECba1Button2
};
And call SetCommandSetL() from the code:
Headers required:
#include <eikbtgpc.h> // CEikButtonGroupContainerLibrary required:
LIBRARY avkon.lib eikcoctl.lib //CEikButtonGroupContainer
Source file:
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
cba->SetCommandSetL(R_CUSTOM_CBA1);
cba->DrawNow();
See also predefined resources in avkon.rsg. For example, to change CBA buttons to Options/Cancel:
cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_CANCEL);
To disable softkeys, use the predefined resource R_AVKON_SOFTKEYS_EMPTY.


(no comments yet)