×
Namespaces

Variants
Actions

About对话框的简单显示

From Nokia Developer Wiki
Jump to: navigation, search

下列简单示例演示了如何使用CAknMessageQueryDialog来显示你程序的关于对话框,这示例中的关于文本内容作为常量字符串定义的(你可以使用其他的替代),这话框的标题就是程序的名字:

Article Metadata

文章
翻译:
hoolee
最后由 hamishwillee 在 14 Feb 2012 编辑

源代码

在你的l01文件中:

#define about_text "App Name\n"\
"Version x.xx.xxx\n"\
"For S60 Symbian OS 9\n"\
"\n"\
"(c) Author\n"\
"2009, All right reserved.\n"\
"\n"\
"EMail:\n"\
"your_address@mail.com"

在rls文件中你需要包括必须的文件:

#ifdef LANGUAGE_01
#include "YourProject.l01"
#endif

在rss文件中需要如下定义:

#include "YourProject.rls"
 
RESOURCE TBUF r_about_text { buf = about_text; }


在程序的appui文件中定义如下:

#include <aknmessagequerydialog.h>
#include "YourRssFile.rsg"
 
void CYourClass::ShowAboutInfoL()
{
_LIT( KtxApplicationName, "Your App Name" );
TBuf<512> mess;
HBufC *aboutText = StringLoader::LoadLC(R_ABOUT_TEXT);
TPtr ptr = aboutText->Des ();
CAknMessageQueryDialog *dlg = CAknMessageQueryDialog::NewL(ptr);
dlg->PrepareLC(R_ABOUT_DIALOG);
dlg->SetHeaderTextL (KtxApplicationName);
dlg->RunLD();
CleanupStack::PopAndDestroy(aboutText);
}

资源定义

RESOURCE DIALOG r_about_dialog
{
flags=EEikDialogFlagNoDrag |EEikDialogFlagCbaButtons |EEikDialogFlagWait;
buttons = R_AVKON_SOFTKEYS_BACK;
items =
{
DLG_LINE
{
type = EAknCtPopupHeadingPane;
id = EAknMessageQueryHeaderId;
control = AVKON_HEADING
{
headinglayout = R_AVKON_LIST_HEADING_PANE_POPUPS;
};
},
DLG_LINE
{
type = EAknCtMessageQuery;
id = EAknMessageQueryContentId;
control = AVKON_MESSAGE_QUERY
{
message = "";
};
}
};
}
This page was last modified on 14 February 2012, at 07:23.
134 page views in the last 30 days.