You Are Here:

Community: Wiki

This page was last modified on 17 September 2009, at 07:55.

Progress and wait notes

From Forum Nokia Wiki

Reviewer Approved   

Following code sample shows how you could use progress and wait notes with your applications. Note that only the effected functions are shown here, thus you are expected to copy-paste the functions to your own class definition.

With this example StartWaitNoteL() can be used to start showing standard wait dialog, when the progress length can not be estimated, for the progress dialog you need to supply the final value as an argument variable when using StartProgressNoteL()-function.

To show the progress with progress dialog you could use UpdateProcessL() to supply the current progress value along side with the progress text.

The callback interface function DialogDismissedL() is called not only if user presses cancel button, but also after ProcessFinishedL() is called. Therefore you should cancel any process inside DialogDismissedL() if, and only if, aButtonId equals to the key used to close dialog, in this case EAknSoftkeyCancel.

Source code

CMyClass::~CMyClass()
{
if(iProgressDialog)
{
iProgressDialog->ProcessFinishedL();
}
 
if(iWaitDialog)
{
iWaitDialog->ProcessFinishedL();
}
}
 
 
void CMyClass::StartWaitNoteL()
{
 
iWaitDialog = new (ELeave) CAknWaitDialog(
(REINTERPRET_CAST(CEikDialog**, &iWaitDialog)),
ETrue);
iWaitDialog->PrepareLC(R_WAIT_NOTE_SOFTKEY_CANCEL);
iWaitDialog->SetCallback(this);
iWaitDialog->RunLD();
}
 
void CMyClass::StartProgressNoteL(TInt aFinalValue)
{
iProgressDialog = new (ELeave) CAknProgressDialog(
(REINTERPRET_CAST(CEikDialog**, &iProgressDialog)),
ETrue);
iProgressDialog->PrepareLC(R_PROGRESS_NOTE);
iProgressInfo = iProgressDialog->GetProgressInfoL();
iProgressDialog->SetCallback(this);
iProgressDialog->RunLD();
iProgressInfo->SetFinalValue(aFinalValue);
}
 
void CMyClass::UpdateProcessL(TInt aProgress,const TDesC& aProgressText)
{
if(iProgressDialog)
{
iProgressDialog->SetTextL(aProgressText);
}
 
if(iProgressInfo)
{
iProgressInfo->SetAndDraw(aProgress);
}
}
 
void CMyClass::DialogDismissedL(TInt aButtonId)
{
iProgressDialog = NULL;
iProgressInfo = NULL;
iWaitDialog = NULL;
 
if (aButtonId == EAknSoftkeyCancel)
{
// cancel any process in here
}
}


Header definitions

#include <eikprogi.h>
#include <aknwaitdialog.h>
#include <AknProgressDialog.h>
// Link against eikctl.lib
 
class CMyClass : public CBase, public MProgressDialogCallback
{
public:
~CMyClass();
 
void StartWaitNoteL();
void StartProgressNoteL(TInt aFinalValue);
void UpdateProcessL(TInt aProgress,const TDesC& aProgressText);
 
protected:// other system interface functions
void DialogDismissedL (TInt aButtonId);
 
private:
CAknProgressDialog* iProgressDialog;
CEikProgressInfo* iProgressInfo;
CAknWaitDialog* iWaitDialog;
};

Resource definitions

RESOURCE DIALOG r_wait_note_softkey_cancel
{
flags = EAknWaitNoteFlags | EEikDialogFlagNotifyEsc;
buttons = R_AVKON_SOFTKEYS_CANCEL;
items =
{
DLG_LINE
{
type = EAknCtNote;
id = EYBWaitNoteId;
control= AVKON_NOTE
{
layout = EWaitLayout;
animation = R_QGN_GRAF_WAIT_BAR_ANIM;
};
}
};
}
 
RESOURCE DIALOG r_progress_note
{
flags = EAknProgressNoteFlags;
buttons = R_AVKON_SOFTKEYS_CANCEL;
items =
{
DLG_LINE
{
type = EAknCtNote;
id = EProgressNoteId;
control = AVKON_NOTE
{
layout = EProgressLayout;
singular_label ="Progressing";
};
}
};
}

You are also expected to have the definitions of EYBWaitNoteId and EProgressNoteId in a hrh file included to your rss file.

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fPortingE5fBlackBerryE5fapplicationsE5fandE5fservicesE5ftoE5fS60E5fplatformX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZseriesE5f60Q qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxs60X qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ