Defining customized buttons using Symbian C++
Article Metadata
Compatibility
S60 2nd Edition
Article
Overview
Defining customized buttons for queries
Description
Customized buttons can be defined in resource files. For example:
RESOURCE CBA r_my_softkey
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyMaybe;
txt = "Maybe"; // Texts can be defined in .loc file(s)
// to support language localization
},
CBA_BUTTON
{
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 =
{
DLG_LINE
{
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.


(no comments yet)