×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Date Query Dialog

    hi all,

    I have made the date query dialog and i am not able to get the date in my variable.

    The dialog is displayed and i am able to input in the dialog but i can't find any thing in the variable.

    The resource as follows :

    ********************************************************
    RESOURCE DIALOG r_aknexquery_data_query_owner_birth_date
    {
    flags = EGeneralQueryFlags;
    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
    items =
    {
    DLG_LINE
    {
    type = EAknCtQuery;
    id = EGeneralQuery;
    control = AVKON_DATA_QUERY
    {
    layout = EDateLayout;
    label = qtn_aknexquery_date_label_DateofBirth;
    control = DATE_EDITOR
    {
    minDate = DATE
    {
    year = AKNEXQUERY_DATE_EDITOR_MIN_DATE;
    };
    maxDate = DATE
    {
    year = AKNEXQUERY_DATE_EDITOR_MAX_DATE;
    };
    flags = AKNEXQUERY_DATE_EDITOR_FLAGS;
    };
    };
    }
    };
    }

    ********************************************************


    And i am using the resource as follows

    ********************************************************

    CAknTextQueryDialog* dlgBirthDate = new (ELeave) CAknTextQueryDialog(BirthDate,CAknQueryDialog::ENoTone);
    dlgBirthDate->ExecuteLD(R_AKNEXQUERY_DATA_QUERY_OWNER_BIRTH_DATE);

    where birthdate is 16bit des.
    ******************************************************** I have also tried with


    TTime initialValue;
    iCoeEnv->ReadResource( temp, R_AKNEXQUERY_DATE_INITIAL_VALUE );
    initialValue.Set( temp );

    CAknTimeQueryDialog* dlg = CAknTimeQueryDialog::NewL(
    initialValue, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_DATA_QUERY_OWNER_BIRTH_DATE );

    CAknQueryControl* control =
    static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );
    CEikDateEditor* dateEdwin = static_cast<CEikDateEditor*>
    ( control->ControlByLayoutOrNull( EDateLayout ) );

    if ( dateEdwin )
    {
    TTime setValue;
    iCoeEnv->ReadResource( temp, R_AKNEXQUERY_DATE_INITIAL_VALUE2 );
    setValue.Set( temp );
    dateEdwin->SetDate( setValue );
    }

    dlg->RunLD();

    but it gives me error.

    Replies awaited..
    Thanks
    -vasant

  2. #2
    Registered User
    Join Date
    Jul 2005
    Location
    Bengaluru, India
    Posts
    747

    Re: Date Query Dialog

    Open the SDK document and seach for the string "Local Query Dialog". You can find good example there:

    Code:
    // The descriptor used for the editor
    TBuf<128> text;
    
    // The descriptor contained the prompt text for the query. The prompt 
    // text can also be defined in the resource structure of the query
    TBuf<128> prompt(_L("Enter data:")); 
    
    // create dialog instance 
    CAknTextQueryDialog* dlg = new( ELeave ) CAknTextQueryDialog( text, prompt );
    
    // Prepares the dialog, constructing it from the specified resource
    dlg->PrepareLC( R_DEMO_DATA_QUERY );
    
    // Sets the maximum length of the text editor
    dlg->SetMaxLength(10);
    
    // Launch the dialog
    if (dlg->RunLD())
        {
        // ok pressed,   text is the descriptor containing the entered text // in the editor. 
        }

  3. #3
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: Date Query Dialog

    hi all,

    I think this will help some people so i am posting my solution.

    TTime aTime;
    aTime.HomeTime(); // initializing with current time

    // Calling the Date Query Dialog //
    CAknTimeQueryDialog* Dialog = CAknTimeQueryDialog::NewL(aTime,CAknQueryDialog::ENoTone);
    Dialog->PrepareLC(R_AKNEXQUERY_DATA_QUERY_BIRTH_DATE);
    Dialog->SetPromptL(_L("Birth Date"));
    if(Dialog->RunLD())
    {
    // fetching the date from dialog //
    aTime.DateTime();
    _LIT( KTimeFormat, "%D%M%Y%1-%2-%3");
    TBuf<20> TimeDesc;
    TBuf<20> Data;
    TRAPD( err, aTime.FormatL( TimeDesc, KTimeFormat) );
    Data.Format(_L("DOB:%S\n"),&TimeDesc);
    Data = EncryptData(Data);
    temp8.Copy(Data);
    file.Write(temp8);

    }

    The above code shows how to get the date from the dialog and store in some file,
    and yes you can use the Resource given in the Query example (C:\symbian\8.0a\S60_2nd_FP2\Series60Ex\query)

    Regards
    vasant

Similar Threads

  1. newbie, having problems with query dialog
    By sbwoodside in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-04-22, 07:01
  2. Date Query
    By djgtram in forum Symbian User Interface
    Replies: 3
    Last Post: 2004-03-17, 22:33
  3. Date Query Editor Dialog
    By Blkangel in forum Symbian
    Replies: 0
    Last Post: 2004-02-11, 10:48
  4. Softkeys in Global query msg dialog
    By nitinkumar in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-04-16, 20:07
  5. How to extend duration limit in query dialog within popup field?
    By khanming in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-10-18, 06:53

Posting Permissions

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