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 over the next few weeks. Thanks for all your past and future contributions.
How to enable empty strings in query dialogs
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
TDes& aText, TTone aTone)
CAllowsEmptyStringsDialog* self =
new (ELeave) CAllowsEmptyStringsDialog(aText, aTone);
TDes& aText, const TTone& aTone)
: CAknTextQueryDialog(aText, aTone)
// No implementation required
// Use as::
CAllowsEmptyStringsDialog* dialog = CAllowsEmptyStringsDialog::NewL(name);