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:
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);
}