×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    34

    Problem showing the SMS body text on RichText Editor

    Hi all,

    I want to get the text messages from the Inbox folder, and then display them on a RichText Editor.

    I am able to get the msgText in a Tbuf Object, but when I show this text on the Editor , It shows strange characters.

    Code:

    ///////////////////////////////////////////////////////////////////////////////////
    TDes CSmsHandler::GetMsgTextL()
    {
    TBuf16<500> SMSContent;

    CMsvEntry* entry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
    CleanupStack::PushL(entry);
    CMsvEntrySelection* entries = entry->ChildrenL();
    CleanupStack::PopAndDestroy(entry) ;



    //entry = NULL ;
    TInt nCount = entries->Count();
    for(TInt index = 0; index < 1; index++) // just getting the first
    // entry for testing
    {


    TMsvId entryID = entries->At(index);



    iSmsMtm->SwitchCurrentEntryL(entryID);
    iSmsMtm->LoadMessageL();
    entry = iSession->GetEntryL(entryID);
    CleanupStack::PushL(entry);
    TMsvEntry msvEntry = entry->Entry();
    TPtrC nn = msvEntry.iDescription;


    CMsvEntry* entry22= iSession->GetEntryL((*entries)[index]);
    CMsvStore* inboxStore= entry22->ReadStoreL();

    if (inboxStore->HasBodyTextL())
    {

    CRichText& richText= iSmsMtm->Body();
    inboxStore->RestoreBodyTextL(richText);
    const TInt length = richText.DocumentLength();

    SMSContent.Zero();
    SMSContent.Copy(richText.Read(0,length));

    }


    CleanupStack::PopAndDestroy(entry); // entry
    }

    return SMSContent;
    }

    /////////////////////////////////////////////////////////////////////////

    In my Application View class I send this TBuf data as a parameter to following function,to draw it on a RichText Editor.

    Code:

    void CRichTextEditorRTE:rawTextWithoutCarriageL( const TDesC& aText )
    {
    CRichText* text = RichText();
    TInt textSize = text->DocumentLength();

    // Interested in color
    iCharacterFormatMask.SetAttrib(EAttColor);
    // Set it to Black
    iCharacterFormat.iFontPresentation.iTextColor = KRgbBlack;
    text->InsertL (textSize, aText);
    // Apply formatting
    text->ApplyCharFormatL(iCharacterFormat, iCharacterFormatMask,
    textSize,aText.Length());
    HandleTextChangedL();
    }
    ///////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////


    But it is showing strange characters on the Mobile screen..

    Is there any special way to show the RichText data??????


    Waiting for ur valuable suggestions.......

    Regards,
    Saad Mansur

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Problem showing the SMS body text on RichText Editor

    Hello

    I use this function to display text in RichText

    void CNiuBukContainerEsms::SetRichTextL(TDesC &aText)
    {
    iRichText1->SetTextL( &aText );
    }

    In my opinion you should change

    text->InsertL (textSize, aText);

    to

    text->InsertL (textSize, &aText);

    and it should work


    Good luck

Similar Threads

  1. problem getting SMS body
    By gs_cmans in forum Symbian
    Replies: 5
    Last Post: 2006-03-14, 18:55
  2. Nokia 30 SMS sending problem !!!!!
    By pgredelj in forum General Messaging
    Replies: 1
    Last Post: 2004-01-12, 12:48
  3. CRichText text problem
    By introuble in forum Symbian User Interface
    Replies: 2
    Last Post: 2003-09-30, 17:29
  4. Nokia 8310 & Nokia PC Suite 4...sms via Phone Editor to another Nokia 8310
    By Nokia_Archived in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-06-09, 11:46
  5. Can I send sms messages with no body text?
    By wonderland7 in forum General Messaging
    Replies: 1
    Last Post: 2001-12-06, 18:42

Posting Permissions

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