Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 04: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 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 04:45.
69 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×