Progress and wait notes

本文介绍如何在Symbian应用中使用进度和等待对话框,包括启动标准等待对话框、设置进度对话框及更新进度等操作,并提供完整的代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Progress and wait notes

From Forum Nokia Wiki


 

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值