Defining customized buttons using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Platform(s): S60 1st Edition
S60 2nd Edition
S60 2nd Edition (initial release)
S60 1st Edition
Created: User:Technical writer 2 (05 May 2003)
Last edited: lpvalente (07 May 2014)


Defining customized buttons for queries


Customized buttons can be defined in resource files. For example:
RESOURCE CBA r_my_softkey
    buttons =
            id = EAknSoftkeyMaybe;
            txt = "Maybe"; // Texts can be defined in .loc file(s)
                           // to support language localization
            id = EAknSoftkeyWhy;
            txt = "Why?";
Customized softkeys are not translated to the device's current language automatically by the framework, but they can be used instead of the built-in buttons anywhere. In case of a Query dialog:
RESOURCE DIALOG r_myconfirmation_query
    flags = EGeneralQueryFlags;
    buttons = r_my_softkey; // note that own softkey is
                            // used as lowercase
    items =
            type = EAknCtQuery;
            id = EGeneralQuery;
            control = AVKON_CONFIRMATION_QUERY;
The Query dialog behaves like any other dialogs and handles the softkeys with the OkToExitL() method:
// class CMyAknQueryDialog: public CAknQueryDialog, ...
#include <eikenv.h>
TBool CMyAknQueryDialog::OkToExitL(TInt aButtonId)
    if (aButtonId == EAknSoftkeyMaybe)
        // Handle "Maybe" key press
    else if (aButtonId == EAknSoftkeyWhy)
        // Handle "Why" key press
    return ETrue;
Code for launching the query dialog remains the same.

This page was last modified on 7 May 2014, at 12:58.
38 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.