×
Namespaces

Variants
Actions

如何自定义询问对话框的按钮

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
User:Jiangbaolan 在 02 Apr 2009 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

自定义按钮需要先构造资源文件,如下: [code] 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?"; } }; } [code] 然后取代询问对话框的默认按纽:

Code: 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;
           },
       ...
       }询问对话框的处理和其他对话框一样,可以通过OkToExit()来处理按键:

Code: // class CMyAknQueryDialog: public CAknQueryDialog, ...

  1. 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;
   }
This page was last modified on 15 December 2011, at 09:34.
35 page views in the last 30 days.
×