difference between active obj and active function?
who knows difference between
user::waitForRequest(iStatus)
and
SetActive()+ RunL(),thank you very much!
, i need a wait dialog in async function, but when i use the former, i can not see wait dialog. my code is following:
if(iWaitDialog)
{
iWaitDialog->ProcessFinishedL();
delete iWaitDialog;
iWaitDialog=NULL;
}
iWaitDialog =
new (ELeave) CAknWaitDialog(NULL, ETrue);
iWaitDialog->SetCallback(this);
iWaitDialog->ExecuteLD(R_BTMAN_WAIT_NOTE_SOFTKEY_CANCEL);
User::WaitForRequest(iStatus);
if(iStatus.Int()==KErrNone)
{
TPtr buf = iInfoBuf->Des();
TPtrC deviceName;
deviceName.Set(iRemoteDeviceName().iName);
iReporter.PrintItem(deviceName,_L("0x0000"));
TBTSockAddr BTSockAddr(iRemoteDeviceName().iAddr);
iReporter.PrintBTInfo(BTSockAddr.BTAddr());
}
else
{
iReporter.PrintLine(_L("sorry,i can not find any btdevice!"));
iHr.Close();//wudilp040319-s
iWaitDialog->ProcessFinishedL(); //wudilp040319-e
}
The user::waitForRequest(iStatus) will wait there and block other AO's to run and SetActive()+ RunL(), will let other to do their tasks as well.
So in case you want to use the wait dialog you should use SetActive()+ RunL(), so your dialog can have time to re-fresh when the function is executing.
you'll get you waitdialog callback function called when the user presses the cancel button.
Then there you just need to cancel the asyncronous function, so basically you'll need to check the documentation for the object and find out how to cancel the operation that you are currently running.