|
|
User login
Feeds |
Confirmation Query
|
|||||
| Tue, 2005-01-11 17:20 | |
Forum posts: 7
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 = "";
};
}
};
}
Forum posts: 1379
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:
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
Forum posts: 23
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
Forum posts: 1379
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
Forum posts: 23
U r right its BIO Parser DLL, and i am on Series 60. 'CAknGlobalConfirmation' works fine now
Forum posts: 23
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
Forum posts: 1
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
Forum posts: 27
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"));
}
Forum posts: 27
and resource is:
reource dialog u have to use:
This is the simple method........................