×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    215

    Question how to retrieve the Date Editor & Time Editor content

    Hi to all,

    I placed a Date Editor & Time Editor in Form View. Can anyone help me how to retrieve the Date Editor & Time Editor content . Once the Form is saved i need to save the content in my DataBase. Please send any sample code for better understand.

    Thanks in Advance.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,179

    Re: how to retrieve the Date Editor & Time Editor content

    have you checked the SDK docs for the APIs already ? the docs are showing all functions provided by the classes.. Also Wiki has RDbNamedDatabase example, so for a database example, you could have a look into it.

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,349

    Re: how to retrieve the Date Editor & Time Editor content

    Nokia Developer Wiki Moderation team

  4. #4
    Registered User
    Join Date
    Sep 2009
    Posts
    215

    Re: how to retrieve the Date Editor & Time Editor content

    Thanks for your reply,

    I had gone through the link & also the SDK docs. Since i was new to Symbian.C++, Still I can't able to retrieve the Date & Time Editor Content. Pls can any one send me any sample coding or link containing sample code for me.

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,349

    Re: how to retrieve the Date Editor & Time Editor content

    What did you try and what did not work? Show your code(how you defined resources for Date editor, how do you access Date/time editor in your form etc...).
    Nokia Developer Wiki Moderation team

  6. #6
    Registered User
    Join Date
    Sep 2009
    Posts
    215

    Re: how to retrieve the Date Editor & Time Editor content

    HI Kiran,
    Actually i'm using two text editor namely Name field & Email Field, Then one Date Editor & Time Editor
    For retrieving the data in the Text Editor I used the following code:
    if ( iEdit1)
    {
    LOGTXT("Enter into Name Editor");
    HBufC* nameditor;
    TBuf<50> EdPtr1;
    nameditor = iEdit1->GetTextInHBufL ();
    EdPtr1 = nameditor->Des ();
    LOGDES8(nameditor);
    }
    And for DateEditor:
    if ( iDateEditor1)
    {
    TBuf<20> Dateditor;
    TDateTime dateeditor;
    dateeditor = iDateEditor1->GetTTime();

    HBufC * tempBuf = NULL;
    tempBuf = StringLoader::LoadLC(R_BIRTHDAY_BUDDY_PROFILE_FORM_ERRORMSG1);
    timeeditor.FormatL(Dateditor, *tempBuf);
    CleanupStack::PopAndDestroy(tempBuf);
    LOGDES8(tempBuf);
    }

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,349

    Re: how to retrieve the Date Editor & Time Editor content

    How do you get the control for Date/Time editor? Are you doing something like this: http://wiki.forum.nokia.com/index.ph..._Control_Value Show your code for that.

    W.r.t to your given code, if you debug your code, does it go inside the if ( iDateEditor1) ?
    Nokia Developer Wiki Moderation team

  8. #8
    Registered User
    Join Date
    Sep 2009
    Posts
    215

    Re: how to retrieve the Date Editor & Time Editor content

    Yeah Kiran, Just now i check out, Its going inside if ( iDateEditor1) .
    The Default code is generated while creating UI.

    Code:
    Code:
    /**
     * Initialize controls and settings before a Form is laid out.  (override)
     */
    void CBirthdayBuddy_ProfileForm::PreLayoutDynInitL()
    	{
    	// [[[ begin generated region: do not modify [Generated Contents]
    	iEdit1 = static_cast< CEikEdwin* >( 
    		ControlOrNull( EBirthdayBuddy_ProfileFormViewEdit1 ) );
    		{
    		HBufC* text = StringLoader::LoadLC( R_BIRTHDAY_BUDDY_PROFILE_FORM_EDIT1 );
    		iEdit1->SetTextL( text );
    		CleanupStack::PopAndDestroy( text );
    		}
    	iEdit2 = static_cast< CEikEdwin* >( 
    		ControlOrNull( EBirthdayBuddy_ProfileFormViewEdit2 ) );
    		{
    		HBufC* text = StringLoader::LoadLC( R_BIRTHDAY_BUDDY_PROFILE_FORM_EDIT2 );
    		iEdit2->SetTextL( text );
    		CleanupStack::PopAndDestroy( text );
    		}
    	iDateEditor1 = static_cast< CEikDateEditor* >( 
    		ControlOrNull( EBirthdayBuddy_ProfileFormViewDateEditor1 ) );
    	iDateEditor1->SetDate( TTime( TDateTime( 2000, EJanuary, 0, 0, 0, 0, 0 ) ) );
    	iTimeEditor1 = static_cast< CEikTimeEditor* >( 
    		ControlOrNull( EBirthdayBuddy_ProfileFormViewTimeEditor1 ) );
    	iTimeEditor1->SetTime( TTime( TDateTime( 0, EJanuary, 0, 0, 0, 0, 0 ) ) );
    	// ]]] end generated region [Generated Contents]
    	
    	LoadFromDataL();
    	}
    Last edited by kiran10182; 2010-06-11 at 12:32. Reason: CODE tags added for better readability

  9. #9
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,349

    Re: how to retrieve the Date Editor & Time Editor content

    So, does it work now or not? If not then how do you access iDateEditor1 later on to access(save) the data?
    Nokia Developer Wiki Moderation team

  10. #10
    Registered User
    Join Date
    Sep 2009
    Posts
    215

    Re: how to retrieve the Date Editor & Time Editor content

    I can able to access IDateEditor1

    But my problem is when i try code it throws the following error:

    Code:
    if ( iDateEditor1)
    {
    /*TDateTime dateditor;
    TBuf<50> EdPtr3;
    dateditor = iDateEditor1->GetTTime(); Error Occured line 1
    no match for 'operator=' in 'timeeditor = (*(((CBirthdayBuddy_ProfileForm*)this)->CBirthdayBuddy_ProfileForm::iDateEditor1->CEikDateEditor::_vptr.CBase + 208u))(((CBirthdayBuddy_ProfileForm*)this)->CBirthdayBuddy_ProfileForm::iDateEditor1)'
    EdPtr3 = dateditor->Des ();
    LOGDES8(dateditor);*/

    TBuf<20> Dateditor;
    TDateTime timeeditor;
    timeeditor = iDateEditor1->GetTTime();

    HBufC * tempBuf = NULL;
    tempBuf = StringLoader::LoadLC(R_BIRTHDAY_BUDDY_PROFILE_FORM_ERRORMSG1);
    timeeditor.FormatL(Dateditor, *tempBuf);Error Occured Line 2
    class TDateTime' has no member named 'FormatL'
    CleanupStack::PopAndDestroy(tempBuf);
    LOGDES8(tempBuf);

    Is there any other alternate method is there to retrieve the Date Content from the Date Editor.

  11. #11
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,349

    Re: how to retrieve the Date Editor & Time Editor content

    If you search in the SDK help for GetTTime, you will find out that(and already in the function name itself) it returns TTime and in your code you are getting it under TDateTime object. Please re-read this link carefully again: http://www.forum.nokia.com/document/...Form_API4.html

    You can get Date using CEikDateEditor where as Time using CEikTimeEditor. Now search for these terms on SDK help and on google.
    Nokia Developer Wiki Moderation team

  12. #12
    Registered User
    Join Date
    Sep 2009
    Posts
    215

    Re: how to retrieve the Date Editor & Time Editor content

    Hi

    I'm using the following code for retrieving the Date from the Date Editor in Form UI.
    code:
    _LIT(KDateFormat,"");
    TBuf <20> StringDate;
    TTime iDate;
    CEikDateEditor* dateEd = (CEikDateEditor*)Control( EBirthdayBuddy_ProfileFormViewDateEditor1 );
    iDate = dateEd->Date();
    iDate.FormatL(StringDate, KDateFormat);
    LOGTXT("StringDate:::");
    LOGDES8(StringDate);

    But i didn't any output in my log file,nothing is displaying. Can anyone help me regarding this please.

  13. #13
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,349

    Re: how to retrieve the Date Editor & Time Editor content

    Search for FormatL on Wiki.

    Here is one piece of code from there: Use it in your code and see what do you get.
    Code:
    _LIT(KDateFormat,"%D%M%Y%/0%1%/1%2%/2%3%/3");
    Nokia Developer Wiki Moderation team

Similar Threads

  1. How to retrieve date item from the date editor?
    By joteddy123 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 6
    Last Post: 2009-03-22, 23:11
  2. Problem while redrawing date from date editor
    By devdattac in forum Symbian User Interface
    Replies: 7
    Last Post: 2008-12-05, 12:35
  3. Date & Time Editor in Form Resource.
    By Kavit Patel in forum Symbian
    Replies: 2
    Last Post: 2008-03-03, 07:26
  4. Date And Time Editor issue
    By girishvmx in forum Symbian User Interface
    Replies: 8
    Last Post: 2008-01-30, 09:43
  5. Date And Time Editor issue
    By Deepa msc in forum Symbian
    Replies: 3
    Last Post: 2008-01-30, 03:30

Posting Permissions

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