Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003

    Using CEikTelephoneNumberEditor to query telephone numbers

    How can I easily query the user for a telephone number?

  2. #2
    Regular Contributor
    Join Date
    Mar 2003

    RE: Using CEikTelephoneNumberEditor to query telephone numbers

    CEikTelephoneNumberEditor is a ready editor for typing in a telepnone numbe in three sections: country code, area code and recipients number.

    Here is a coding example of the use of CEikTelephoneNumberEditor

    First you define your own Telephone Number Dialog in the resource(.rss) file:

    #include "myapp.hrh"

    RESOURCE DIALOG r_myapp_tel_number_dialog
    title = "Telephone Number";
    buttons = R_EIK_BUTTONS_CANCEL_OK;
    flags = EEikDialogFlagWait;
    items =
    type = EEikCtTelephoneNumberEditor;
    prompt = "Recipient";
    id = EMYAPPTelNumEditor;
    control = TELNUMBER
    country_prompt = "[country]";
    area_prompt = "[area]";
    number_prompt = "[number]";
    widthinpixels = 200;

    In the .hrh file we define an enumeration id for this dialog:

    EMYAPPTelNumEditor //this defaults to 0

    In the header file you must include eikdialg.h and declare the dialog.

    #include <eikdialg.h>

    const TInt KMaxTelephoneNumberLength = 30; // define max length for number

    class CMYAPPTelNumDialog : public CEikDialog
    CMYAPPTelNumDialog(TDesC& aRecipientsTelNum);
    TBool OkToExitL(TInt aButtonId);
    void PreLayoutDynInitL();
    TDesC* iRecipientsTelNum; //the telNumber is stored here

    And finally in the .cpp file we define the controls for showing the dialog:

    CMYAPPTelNumDialog::CMYAPPTelNumDialog(TDesC& aRecipientsTelNum)
    : iRecipientsTelNum(&aRecipientsTelNum)

    void CMYAPPTelNumDialog::PreLayoutDynInitL()
    { (static_cast<CEikTelephoneNumberEditor*>(Control(EMYAPPTelNumEditor)))->SetNumberL(*iRecipientsTelNum);

    TBool CMYAPPTelNumDialog::OkToExitL(TInt /*aButtonId*/)
    TBuf<KMaxTelephoneNumberLength> recipientsTelNum;
    if (recipientsTelNum.Length()==0)
    return EFalse;
    return ETrue;

    This is how you set and use the dialog:


    CMYAPPTelNumDialog* telNumDialog = new(ELeave) CMYAPPTelNumDialog(*iRecipient);


    // now iRecipient has the telephone number

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts