×
Namespaces

Variants
Actions

Confirmation Query

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: symbianyucca (09 Apr 2007)
Last edited: hamishwillee (20 Jul 2012)
Reviewer Approved    Thumbs up icon sm.jpg

CAknQueryDialog API can also be used as a confirmation query, following function illustrates how you could use it for this purpose:

Headers:

  1. include <aknglobalconfirmationquery.h>

Libraries:

aknnotify.lib eiksrv.lib


TInt ShowQueryDialogL(const TDesC& aMessage)
{
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
return dlg->ExecuteLD(R_QUERY,aMessage);
}

another usage...

TBool ShowQueryDialogL(const TDesC& aMessage)
{
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
TBool answer( dlg->ExecuteLD( R_QUERY,aMessage ) );
return answer;// True=YES, False=NO
}



As all dialogs CAknQueryDialog also requires resource definition, with this example function you could use following resource definition:

RESOURCE DIALOG R_QUERY
{
flags = EGeneralQueryFlags;
buttons = R_AVKON_SOFTKEYS_YES_NO;
items =
{
DLG_LINE
{
type = EAknCtQuery;
id = EGeneralQuery;
control = AVKON_CONFIRMATION_QUERY
{
layout = EConfirmationQueryLayout;
animation = R_QGN_NOTE_INFO_ANIM;
};
}
};
}

If you want to use confirmation queries without resource definitions, you could also utilize CAknGlobalConfirmationQuery API for example like this:

TBool ShowQueryDialogL(const TDesC& aMessage)
{
CAknGlobalConfirmationQuery* QlobalQ = CAknGlobalConfirmationQuery::NewL();
CleanupStack::PushL(QlobalQ);
 
TRequestStatus theStat = KRequestPending;
QlobalQ->ShowConfirmationQueryL(theStat, aMessage, R_AVKON_SOFTKEYS_YES_NO);
User::WaitForRequest(theStat);
 
CleanupStack::PopAndDestroy(QlobalQ);
if(theStat.Int() == EAknSoftkeyYes)
{
return ETrue;
}
else
{
return EFalse;
}
}
This page was last modified on 20 July 2012, at 10:17.
42 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×