Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

How to enable empty strings in query dialogs

From Wiki
Jump to: navigation, search
Article Metadata
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
static CAllowsEmptyStringsDialog* NewL(
TDes& aText, TTone aTone = ENoTone);
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;
TDes& aText, const TTone& aTone)
: CAknTextQueryDialog(aText, aTone)
// No implementation required
void CAllowsEmptyStringsDialog::UpdateLeftSoftKeyL()
// Use as::
CAllowsEmptyStringsDialog* dialog = CAllowsEmptyStringsDialog::NewL(name);


Querying Strings

This page was last modified on 26 July 2012, at 03:17.
15 page views in the last 30 days.