Namespaces
Variants
Actions
Revision as of 09:12, 13 June 2012 by hamishwillee (Talk | contribs)

Creating a confirmation query dialog with an animation on Symbian

Jump to: navigation, search
Article Metadata

Tested with
Devices(s): Nokia N93

Compatibility
Platform(s): S60 3rd Edition, FP1

Article
Keywords: CAknQueryDialog, BMPANIM_FRAME, BMPANIM_DATA, CAknQueryDialog::ExecuteLD()
Created: aknyman (09 Jun 2008)
Last edited: hamishwillee (13 Jun 2012)

Contents

Overview

This code snippet shows how to create a confirmation query dialog with an animation. The dialog animation is defined in the application's resource file and the class CAknQueryDialog is used to create it. This example uses four image files (Ballm.bmp and Ball2m.bmp are masks used) from folder \images.


This snippet can be self-signed.

MMP file

The following libraries are required:

LIBRARY avkon.lib   //Avkon resources


Resource file

.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"


Source file

#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...
}


Postconditions

The confirmation query dialog with an animation is shown to the user.

See also

Implementing Animation using CAknBitmapAnimation

133 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved