Wraping of Text.Problem in CEikTextListBox!!!

Login to reply to this topic.
Mon, 2006-02-06 14:32
Joined: 2005-11-12
Forum posts: 68
Hi all,
could any one pls help me to wrap a lengthy text onto the next line and also to create a horizoltal Scroll Bar

Pls send me some hints at the earliest.
im using CEikTextListBox.

I am sending some codes.

void CPMPChatContainer::ConstructL(const TRect& aRect)
    {
iOutputText = HBufC::NewL( KMaxLineLength );

   
    CreateWindowL();
   
   
    SetRect( aRect );
    SetBlank();
    SetBorder(TGulBorder::EFlatContainer);
    iMsgIndex = NULL;

   
    iListBox = new ( ELeave ) CEikTextListBox;
    iListBox->SetContainerWindowL( *this );
    iListBox->ConstructL( this, NULL );
    rect.SetRect(1,0,175,70);
    iListBox->SetRect( rect );
   
    iListBox->ActivateL();
    iListBox->CreateScrollBarFrameL( ETrue );
    iListBox->ScrollBarFrame()
            ->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn,
              CEikScrollBarFrame::EOn );
   
    iListBox->SetDimmed( EFalse );
   
    iMessageList = new ( ELeave ) CDesCArrayFlat( KGranularityOfArray );

    CTextListBoxModel* model = iListBox->Model();
    model->SetItemTextArray( iMessageList );
    model->SetOwnershipType( ELbmOwnsItemArray ); // Transfer ownership
                                                  // of iMessageList

    ActivateL();
    MakeVisible( ETrue );
   
   
    }
void CPMPChatContainer::ShowMessageL(const TDesC& aMsg)
   {
   
   TInt spaceRemaining = 20 - aMsg.Length();
//    TInt spaceRemaining = KMaxLineLength - iOutputText->Des().Length();
   
   if(spaceRemaining>=0)
   {   
   iOutputText->Des().Append( aMsg.Left(spaceRemaining));   

   iMessageList->AppendL( *iOutputText );
   
   
    CListBoxView*view = iListBox->View();
    view->MoveCursorL(CListBoxView::ECursorLastItem,CListBoxView::EContiguousSelection);
   
//   iListBox->DrawNow();
    iListBox->HandleItemAdditionL();
    iListBox->SetFocus(ETrue,EDrawNow);
    //iListBox->SetCurrentItemIndexAndDraw(iMessageList->Count() - 1);
   
    iOutputText->Des().Zero();
   }
   
  Thanks and regards
Priju
  • Login to reply to this topic.