×
Namespaces

Variants
Actions

How to enable empty strings in query dialogs

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: kiran10182 (13 Aug 2007)
Last edited: hamishwillee (26 Jul 2012)

By default query dialogs will show the OK softkey only if you enter some text in to the edit control(s). This behaviour can be changed by overriding the UpdateLeftSoftKeyL() function. All other functions for queries work as they would normally, for example RunLD() or ExecuteLD().

In the case of multiline queries, note the following:

  • Use the ControlByLayoutOrNull() function with a control id of EMultiDataFirstEdwin or EMultiDataSecondEdwin.
  • You must call SetDataL() in the case of multiline data query controls.

Below is an implmentation of the class; no RSS is provided as the standard resource works just fine.

class CAllowsEmptyStringsDialog : public CAknTextQueryDialog
{
public:
 
static CAllowsEmptyStringsDialog* NewL(
TDes& aText, TTone aTone = ENoTone);
 
protected:
 
CAllowsEmptyStringsDialog(TDes& aText, const TTone& aTone);
 
protected: // from CAknTextQueryDialog
 
void UpdateLeftSoftKeyL();
};
CAllowsEmptyStringsDialog* CAllowsEmptyStringsDialog::NewL(
TDes& aText, TTone aTone)
{
CAllowsEmptyStringsDialog* self =
new (ELeave) CAllowsEmptyStringsDialog(aText, aTone);
return self;
}
 
CAllowsEmptyStringsDialog::CAllowsEmptyStringsDialog(
TDes& aText, const TTone& aTone)
: CAknTextQueryDialog(aText, aTone)
{
// No implementation required
}
 
void CAllowsEmptyStringsDialog::UpdateLeftSoftKeyL()
{
MakeLeftSoftkeyVisible(ETrue);
}
// Use as::
{
CAllowsEmptyStringsDialog* dialog = CAllowsEmptyStringsDialog::NewL(name);
dialog->ExecuteLD(R_ALLOWSEMPTYSTRING_PROMPT_QUERY);
}

Links

Querying Strings

This page was last modified on 26 July 2012, at 06:17.
56 page views in the last 30 days.
×