Confirmation Query

Login to reply to this topic.
Tue, 2005-01-11 17:20
Joined: 2003-11-07
Forum posts: 15
Does someone has simple source code to create and display a confirmation query (just to ask a small YES/NO question to the user) ?

I caanot believe I have to derivate my own query class with an active object to do such simple task.

Thanks.

Wed, 2005-01-12 01:12
Joined: 2004-12-13
Forum posts: 7
Confirmation Query
here you go..

TInt CMyExampleApp::ConfirmationQuery(const TDesC& aQueryTxt, TBool aSound)
{
CAknQueryDialog* dlg = CAknQueryDialog::NewL(aSound ? CAknQueryDialog::EConfirmationTone : CAknQueryDialog::ENoTone);
dlg->PrepareLC(R_YES_NO_DIALOG);
CAknQueryControl* control = STATIC_CAST(CAknQueryControl*,dlg->ControlOrNull(EGeneralQuery));
control->SetPromptL(aQueryTxt);
return (dlg->RunLD());
}

and in your resource file

RESOURCE DIALOG r_yes_no_dialog
 {
 flags = EGeneralQueryFlags;
 buttons = R_AVKON_SOFTKEYS_YES_NO;
 items =
   {
   DLG_LINE
     {
     type = EAknCtQuery;
     id = EGeneralQuery;
     control = AVKON_CONFIRMATION_QUERY
       {
       layout = EConfirmationQueryLayout;
       label = "";
       };
     }
   };
 }
Wed, 2005-01-12 09:45
Joined: 2004-07-28
Forum posts: 1379
Confirmation Query
You don't need:

Code:

CAknQueryControl* control = STATIC_CAST(CAknQueryControl*,dlg->ControlOrNull(EGeneralQuery));
control->SetPromptL(aQueryTxt);


Just use the version of NewL which takes the prompt text - then you can also replace your PrepareLC/RunLD with just ExecuteLD:

Code:
CAknQueryDialog* dlg = CAknQueryDialog::NewL(aQueryTxt, aSound ? CAknQueryDialog::EConfirmationTone : CAknQueryDialog::ENoTone);
return dlg->ExecuteLD(R_YES_NO_DIALOG);

If you really want a simple, quick dialog with no resource, use CEikonEnv::InfoWinL, CEikonEnv::QueryWinL or CEikonEnv::AlertWin - CEikonEnv::QueryWinL being the one which shows a yes/no query.

didster

Tue, 2005-07-19 08:47
Joined: 2005-07-04
Forum posts: 23
Re: Confirmation Query
Hi
Can u tell me how can i use ' CEikonEnv::QueryWinL '
I am trying to use it here but it doesnt go in the fucntion

void CMyBioParser::ProcessL( TRequestStatus& aStatus )
    {
   
    TMsvEntry entry = iEntry.Entry();
   // 0 = not parsed
   // 1 = parsed
   // 2 = processed
   // any other is unknown

TBool answer = ETrue;

answer = CEikonEnv::QueryWinL(_L("Do you want to install new config file?"),_L("")); // does work
if (answer)
{
// they pressed yes

   TFileName name( _L("c:\\system\\data\\MyIniFile.ini") );
   StoreL( name );

}
else
{
// they pressed no
}
// more lines of code...

PLz help. As i awant to display a simple yes/no dailog
thanks

Tue, 2005-07-19 15:04
Joined: 2004-07-28
Forum posts: 1379
Re: Confirmation Query
Looking at the class name, I assume this is a BIO parser DLL?

CEikonEnv::QueryWin only works from within an APP - i.e. an application that uses the EIKON framework.

If you wish to display a note outside of this environment, i.e. in a EXE or in your case a BIO parser you have to use the global query dialogs that use the notifer API.

If your on series 60, you can accomplish it like this:

CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL();
CleanupStack::PushL(pQ);

_LIT(KQuestion, ""Do you want to install new config file?");

TRequestStatus theStat = KRequestPending;
pQ->ShowConfirmationQueryL(theStat, KQuestion, R_AVKON_SOFTKEYS_YES_NO);
User::WaitForRequest(theStat);
   
CleanupStack::PopAndDestroy(pQ);
TBool answer = (theStat.Int() == EAknSoftkeyYes);

didster

Wed, 2005-07-20 10:35
Joined: 2005-07-04
Forum posts: 23
Re: Confirmation Query
Thanks alot for ur help. IT works fine now.
U r right its BIO Parser DLL, and i am on Series 60.  'CAknGlobalConfirmation' works fine now  Smiley
Wed, 2005-08-03 14:47
Joined: 2005-07-04
Forum posts: 23
Re: Confirmation Query
HI Didster,
I just realised tht i should put all the strings visible to user in the resource file and try to call the from my ProcessL method of Parser.

I am trying to do it as : 

     RResourceFile resourceFile;
    // Opens file, leaves on error
    resourceFile.OpenL(iFs,KRscFileLocation);

//Parameter is necessary in ConfirmSignatureL, but not used in function
   resourceFile.ConfirmSignatureL(0);
   
// Read the first resource & construct a resource reader
HBufC8* res = resourceFile.AllocReadLC(R_UK_UPDATE_CONFIGFILE_QUERY_TEXT);
HBufC8* res = resourceFile.AllocReadLC(R_TEST);

TResourceReader theReader;
theReader.SetBuffer(res);

TMsvEntry entry = iEntry.Entry();
   // 0 = not parsed
   // 1 = parsed
   // 2 = processed
   // any other is unknown

   HBufC* textResource = theReader.ReadHBufC16L();
  CleanupStack::PushL(textResource);

   CAknGlobalConfirmationQuery* temp = CAknGlobalConfirmationQuery::NewLC();
   temp->ShowConfirmationQueryL ( aStatus,*textResource, R_AVKON_SOFTKEYS_OK_CANCEL );
   User::WaitForRequest( aStatus );
   CleanupStack::PopAndDestroy(&textResource);
   CleanupStack::PopAndDestroy(); // temp


But it falls to read in TEXTRESOURCSE  variable  from the TResourceReader..

My resouce file is

//  RESOURCE IDENTIFIER
NAME    UKIN // 4 letter ID

//  INCLUDES

#include <eikon.rh>
#include <avkon.rh>
#include <avkon.rsg>
#include "ukinirecognizerdll.loc"  // to define  qtn_app_short_query_string

//  RESOURCE DEFINITIONS

RESOURCE RSS_SIGNATURE {}

RESOURCE TBUF { buf=""; }

RESOURCE TBUF r_uk_update_configfile_query_text
   { buf = qtn_app_short_query_string; }



Plz give an idea wht is wrong here or how i can read the resource file from a BIO parser Dll.
Thanks
Tue, 2008-02-26 14:09
Joined: 2008-02-26
Forum posts: 1
Re: Confirmation Query

hello,
I want to use the yes or no input box. but it dont function, it close application. I have try :
TBool boolresponse = iEikonEnv->QueryWinL(_L("Some long text."),_L("Continue?"));
then
TBool boolresponse = CEikonEnv::QueryWinL(_L("Send by Sms"),_L("Send by Sms"));

and finally example with CAknGlobalConfirmationQuery. This line close application
CAknGlobalConfirmationQuery* temp = CAknGlobalConfirmationQuery::NewLC();

Do you know why?
thank's

Fri, 2008-09-19 12:37
Joined: 2008-08-28
Forum posts: 27
Re: Confirmation Query

The code is:

TBuf<256> msg(_L("Delete it?"));
CAknQueryDialog* dlg = CAknQueryDialog::NewL( );
if ( dlg->ExecuteLD( R_CONFIRMATION_QUERY_LIST, msg))
{
CAknInformationNote* In=new(ELeave) CAknInformationNote;
In->ExecuteLD(_L("DELETED"));
}
else
{
CAknInformationNote* In=new(ELeave) CAknInformationNote;
In->ExecuteLD(_L("NOT DELETED"));
}

Fri, 2008-09-19 12:44
Joined: 2008-08-28
Forum posts: 27
Re: Confirmation Query

and resource is:
reource dialog u have to use:
This is the simple method........................

  • Login to reply to this topic.