×
Namespaces

Variants
Actions

显示多行信息的询问对话框

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

文章
huwell 在 02 Jul 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 设备, 软件 版本:

S60 3rd Edition


  • 详细描述:

下列代码演示了如何使用一个可以显示多行信息的询问对话框:

_LIT(KTxtApplicationName, "Application Title");
 
HBufC* sMessage =
 
StringLoader::LoadLC( R_MESSAGE );
 
HBufC* sTitle = HBufC::NewLC( KTxtApplicationName().Length() );
 
sTitle->Des().Append( KTxtApplicationName );
 
CAknMessageQueryDialog* dialog = new ( ELeave ) CAknMessageQueryDialog();
 
CleanupStack::PushL( dialog );
 
dialog->PrepareLC( R_AVKON_MESSAGE_QUERY_DIALOG );
 
dialog->QueryHeading()->SetTextL( *sTitle );
 
dialog->SetMessageTextL( *sMessage );
 
dialog->RunLD();
 
CleanupStack::Pop(); // dialog
 
CleanupStack::PopAndDestroy(2); // sTitle, sMessage


要显示在对话框中的信息是从资源文件加载的,我们在.rss文件中需要有如下定义:

    #define qtn_message “First Line \nSecond Line”    
 
RESOURCE TBUF r_message
 
{
 
buf = qtn_message;
 
}
This page was last modified on 15 December 2011, at 12:59.
49 page views in the last 30 days.
×