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.

Formatting an input dialog to accept large string of only digits

From Wiki
Jump to: navigation, search
Article Metadata
Platform(s): S60 1st Edition
S60 2nd Edition
S60 2nd Edition (initial release)
S60 1st Edition
Keywords: CAknNumberQueryDialog
Created: User:Technical writer 2 (27 Mar 2003)
Last edited: hamishwillee (18 Sep 2012)



Formatting an input dialog to accept large string of only digits


I want to prompt the user for a 15-digit serial number. I am currently using a CAknTextQueryDialog because CAknNumberQueryDialog only accepts an integer and would not handle enough digits.

I am happy to get the number supplied as a 15-character string but currently the CAknTextQueryDialog accepts all characters, which makes it much harder for the user to enter the serial number.

Is it possible to get an input dialog to accept a large string which is just digits?


It is possible to specify flags for the Edwin editor to restrict the acceptable input. The input dialog resource will look like this in a general case:

control=EDWIN { maxlength=15; };

The editor customization inserted into the dialog’s PrepareLC() method:

void CTestDlgDialog::PrepareLC(TInt aResourceId)
CEikDialog::PrepareLC( aResourceId );
// Dialog base class can be CAknDialog
//CAknDialog::PrepareLC( aResourceId );
// Pick up the Editor control from the dialog
CEikEdwin* control = static_cast<CEikEdwin*>(ControlOrNull(EMyQuery));
// Set the input mode
// Restrict the other input modes


The previous example is a comfortable way to enter long numbers. However, it allows entering characters like "*#pw+", using the  '*' or '#' keys. This can be disabled by monitoring the key input or by displaying a note to the end user if the entered input contains more than just numbers.

This page was last modified on 18 September 2012, at 05:57.
80 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.