class CAknProgressDialog : public CAknNoteDialog |
A note dialog with a timer. Display the note only if the process is at least 1 second long in order to avoid a note quickly flashing on the screen. Display the note for at least 1.5 seconds (even if the client process is shorter that this). The client can specify an initial delay when displaying the note. Timer events are used for displaying and dismissing the dialog. The client can set the progress by specifying the values in the constructors provided.
Fixed process length
iProgressDialog = new(ELeave)CAknProgressDialog(model->FinalValue(),model->Increment(), model->Interval(), (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressDialog->ExecuteLD(R_PROGRESS_NOTE);
Variable process length
iProgressDialog = new(ELeave)CAknProgressDialog( (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressInfo = iProgressDialog->GetProgressInfoL(); iProgressInfo->SetFinalValue(model->FinalValue()); iProgressDialog->ExecuteLD(R_PROGRESS_NOTE);
// Incrementing progress of the process: iProgressInfo->IncrementAndDraw(model->Increment());
// Process finished iProgressDialog->ProcessFinishedL(); // deletes the dialog
Variable process length, modal dialog
Set following flags in resources: EEikDialogFlagWait and EAknProgressNoteFlags
iProgressDialog = new(ELeave)CAknProgressDialog( (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressInfo = iProgressDialog->GetProgressInfoL(); iProgressInfo->SetFinalValue(model->FinalValue()); iProgressInfo->SetTone( CAknNoteDialog::EConfirmationTone ); iProgressDialog->ExecuteLD(R_PROGRESS_NOTE);
// Incrementing progress of the process: iProgressInfo->IncrementAndDraw(model->Increment());
// Process finished iProgressDialog->ProcessFinishedL(); // deletes the dialog
Setting label dynamically
iProgressDialog = new(ELeave)CAknProgressDialog( (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressDialog->PrepareLC(R_PROGRESS_NOTE); iProgressDialog->SetTextL(_L("Hello AVKON!")); iProgressDialog->RunLD();
Inherit from pure virtual class MProgressDialogCallback
Implement DialogDismissedL
Call CAknProgressDialog->SetCallback(this);
Or make your dialog modal. If the dialog is used as a modal, RunLD returns 0 if the dialog is dismissed and EAknSoftkeyDone if not.
Always set EEikDialogFlagNotifyEsc. (or use preset avkon dialog resource flag, i.e. EAknProgressNoteFlags).
To make a dialog modal use EEikDialogFlagWait
Note! If aVisibilityDelayOff is set to ETrue in constructor the dialog will be visible immediality. This should only be used in cases where the process lasts ALWAYS atleast 1.5 seconds.
For comprehensive example, see
Public Member Functions | |
---|---|
CAknProgressDialog(TInt, TInt, TInt, CEikDialog **) | |
CAknProgressDialog(CEikDialog **) | |
CAknProgressDialog(CEikDialog **, TBool) | |
~CAknProgressDialog() | |
IMPORT_C CEikProgressInfo * | GetProgressInfoL() |
IMPORT_C void | HandlePointerEventL(const TPointerEvent &) |
IMPORT_C TKeyResponse | OfferKeyEventL(const TKeyEvent &, TEventCode) |
IMPORT_C void | ProcessFinishedL() |
IMPORT_C TInt | RunLD() |
IMPORT_C void | SetCallback(MProgressDialogCallback *) |
Protected Member Functions | |
---|---|
TInt | DialogTimerCallback(TAny *) |
TInt | DialogTimerEvent() |
IMPORT_C TBool | OkToExitL(TInt) |
IMPORT_C void | PreLayoutDynInitL(void) |
Private Member Functions | |
---|---|
IMPORT_C void | CAknNoteDialog_Reserved() |
IMPORT_C void | CEikDialog_Reserved_1() |
IMPORT_C void | CEikDialog_Reserved_2() |
IMPORT_C void * | ExtensionInterface(TUid) |
Protected Member Enumerations | |
---|---|
enum | TProgressDialogState { EProcessOnDisplayOff, EProcessOnDisplayOn, EProcessOffDisplayOff, EProcessOffDisplayOn, EProcessOffDisplayOnCanBeDismissed, EProcessOnDisplayOnCanBeDismissed } |
Inherited Enumerations | |
---|---|
CAknNoteDialog:TTimeout | |
CAknNoteDialog:TTone | |
CCoeControl:TZoomType | |
CEikDialog:@121 |
Protected Attributes | |
---|---|
MProgressDialogCallback * | iCallback |
TTimerModel | iModel |
CPeriodic * | iProgressDialogTimer |
TProgressDialogState | iState |
TBool | iVisibilityDelayOff |
Private Attributes | |
---|---|
CCancelWhileHidden * | iCancelWhileHidden |
TBool | iInternalTimerControl |
CAknProgressTimer * | iProgressTimer |
TInt | iSpare |
IMPORT_C | CAknProgressDialog | ( | TInt | aFinalValue, |
TInt | anIncrement, | |||
TInt | anInterval, | |||
CEikDialog ** | aSelfPtr | |||
) |
Constructor Use this when the length (in time) of the process is known.
TInt aFinalValue | Final value for the process |
TInt anIncrement | Increment of the process |
TInt anInterval | Interval of the process |
CEikDialog ** aSelfPtr | Pointer to itself. The pointer must be valid when the dialog is dismissed and it must not be on the stack. |
IMPORT_C | CAknProgressDialog | ( | CEikDialog ** | aSelfPtr | ) |
Constructor Use this if the length of the process is unknown but the progress can be calculated.
CEikDialog ** aSelfPtr | Pointer to itself. The pointer must be valid when the dialog is dismissed and it must not be on the stack. |
IMPORT_C | CAknProgressDialog | ( | CEikDialog ** | aSelfPtr, |
TBool | aVisibilityDelayOff | |||
) |
Constructor Use this if the length of the process is unknown but the progress can be calculated.
CEikDialog ** aSelfPtr | Pointer to itself. The pointer must be valid when the dialog is dismissed and it must not be on the stack. |
TBool aVisibilityDelayOff | If set ETrue the dialog will be visible immediality. Use only when the length of the process is ALWAYS over 1.5 seconds. |
TInt | DialogTimerCallback | ( | TAny * | aPtr | ) | [protected, static] |
Timer callback.
TAny * aPtr | Pointer to this |
IMPORT_C void * | ExtensionInterface | ( | TUid | aInterface | ) | [private, virtual] |
From CAknControl
TUid aInterface |
IMPORT_C void | HandlePointerEventL | ( | const TPointerEvent & | aPointerEvent | ) | [virtual] |
HandlePointerEventL processes pointer events directed at the ProgressDialog.
const TPointerEvent & aPointerEvent | Pointerevent to be handled. |
IMPORT_C TKeyResponse | OfferKeyEventL | ( | const TKeyEvent & | aKeyEvent, |
TEventCode | aType | |||
) | [virtual] |
Handle key events (part of CONE framework)
const TKeyEvent & aKeyEvent | |
TEventCode aType |
IMPORT_C TBool | OkToExitL | ( | TInt | aButtonId | ) | [protected, virtual] |
Called by the dialog framework, returns true if the dialog can exit, false otherwise.
TInt aButtonId | Id of the softkey which was pressed |
IMPORT_C void | PreLayoutDynInitL | ( | void | ) | [protected, virtual] |
Initializes dialog before layout is executed (part of dialog framework).
void |
IMPORT_C void | ProcessFinishedL | ( | ) |
This must be called when the dialog must be dismissed. It stops the timer and deletes the dialog.
IMPORT_C TInt | RunLD | ( | ) | [virtual] |
Executes the dialog (part of dialog framework). PrepareLC needs to be called before this.
IMPORT_C void | SetCallback | ( | MProgressDialogCallback * | aCallback | ) |
This callback notifies the client when the dialog is dismissed.
MProgressDialogCallback * aCallback |
Enumeration to handle progress states
EProcessOnDisplayOff | |
EProcessOnDisplayOn | |
EProcessOffDisplayOff | |
EProcessOffDisplayOn | |
EProcessOffDisplayOnCanBeDismissed | |
EProcessOnDisplayOnCanBeDismissed |
can be dismissed when process ends |
TBool | iVisibilityDelayOff | [protected] |
Boolean to declare whether the visibility delay should be on or off.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.