×
Namespaces

Variants
Actions
Revision as of 07:45, 14 June 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Changing softkeys dynamically and disabling them in Symbian

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition
S60 3rd Edition
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
S60 1st 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>   // CEikButtonGroupContainer

Library 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.

This page was last modified on 14 June 2012, at 07:45.
82 page views in the last 30 days.
×