×
Namespaces

Variants
Actions

生成一个带动画的确认对话框

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

文章
hoolee 在 05 Aug 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

CS001055


设备, 软件 版本: S60 3rd Edition, FP1


Contents

详细描述

下面的代码片段演示了如何生成一个带动画显示的确认对话框。对话框中的动画可以定义在应用程序的资源文件中,通过CAknQueryDialog使用并声称它。这个示例使用是存放在\image文件夹中的四个图片文件(Ballm.bmp和Ball2m.bmp用来遮罩效果)。

该代码可以自签名使用。


MMP文件

需要下列链接库

LIBRARY     avkon.lib   //Avkon resources


资源文件

.mmp

//...
SOURCEPATH ..\data
 
START RESOURCE Animation.rss
HEADER
TARGET Animation_0xEB023C9A
TARGETPATH resource\apps
END //RESOURCE
 
 
START BITMAP Animation.mbm
HEADER
TARGETPATH \private\EB023C9A
SOURCEPATH ..\Images
SOURCE 2 Ball.bmp
SOURCE 2 Ballm.bmp
SOURCE 2 Ball2.bmp
SOURCE 2 Ball2m.bmp
END
//...

.rss

//  INCLUDES
#include <eikon.rh>
#include <avkon.rsg>
#include <avkon.rh>
#include <appinfo.rh>
#include "Animation.hrh"
#include "Animation.rls"
#include <Animation.mbg>
 
//...
 
RESOURCE ARRAY r_example_animation_array
{
items=
{
BMPANIM_FRAME { bmpid=EMbmAnimationBall; maskid=EMbmAnimationBallm;},
BMPANIM_FRAME { bmpid=EMbmAnimationBall2; maskid=EMbmAnimationBallm;}
};
}
 
 
RESOURCE BMPANIM_DATA r_example_query_animation
{
frameinterval = 250;
playmode = EAknBitmapAnimationPlayModeCycle;
bmpfile = "\private\EB023C9A\animation.mbm";
frames = r_example_animation_array;
}
 
 
RESOURCE DIALOG r_example_animation_dialog
{
flags = EGeneralQueryFlags;
buttons = R_AVKON_SOFTKEYS_YES_NO;
items=
{
DLG_LINE
{
type = EAknCtQuery;
id = EGeneralQuery;
control = AVKON_CONFIRMATION_QUERY
{
layout = EConfirmationLayout;
label = "Yes / No";
animation = r_example_query_animation;
};
}
};
}


.pkg

//...
"$(EPOCROOT)Epoc32\data\z\resource\apps\Animation_0xEB023C9A.rsc"
-"!:\resource\apps\Animation_0xEB023C9A.rsc"
"$(EPOCROOT)Epoc32\data\z\private\EB023C9A\animation.mbm"
-"!:\private\EB023C9A\animation.mbm"

资源文件

#include <Animation_0xEB023C9A.rsg>
#include <aknquerydialog.h>
 
//...
CAknQueryDialog* exampleDialog = CAknQueryDialog::NewL();
TInt selection = exampleDialog->ExecuteLD(R_EXAMPLE_ANIMATION_DIALOG);
 
if (selection == EAknSoftkeyYes)
{
//"Yes" selected, do something...
}
else
{
//"No" selected, do something...
}
This page was last modified on 15 December 2011, at 08:56.
44 page views in the last 30 days.
×