Need help to Wrap and Display long text

Login to reply to this topic.
Tue, 2005-08-30 13:48
Joined: 2005-07-21
Forum posts: 8
 Hi,

I want to display several items, each has long text(from 20 to 100 characters). My first trial is using EikEdwin, but text only display in one line in nonediting mode. Even after calling SetWordWrapL(ETrue), I got the same display.

My code is as follows,
CEikEdwin* myEdwin = STATIC_CAST(CEikEdwin*, myEdControl) ;
myEdwin->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable,10,64,10);
myEdwin->CreateTextViewL();
myEdwin->SetWordWrapL(ETrue);
myEdwin->SetTextL(iResult->GetItemValue(i));

My question is
1. How can I display long text in nonediting mode with edwin, just like a sms viewer?
2. Is there other better control to use other than edwin? after searching document, my impression is the Eiklabel is similar, and ListBox seems cannot wrap text either

Thanks,

Wed, 2005-09-14 14:28
Joined: 2005-07-16
Forum posts: 127
Re: Need help to Wrap and Display long text
Hi,

If you have not found your solution yet. Try the following code:

iEdwin = new (ELeave) CEikEdwin();
iEdwin->ConstructL( CEikEdwin::ENoAutoSelection |
                          CEikEdwin::EDisplayOnly |
                          CEikEdwin::EReadOnly );   
iEdwin->SetContainerWindowL(*this);
iEdwin->SetBorder(TGulBorder::EThickDeepRaisedWithOutline);
iEdwin->CreateScrollBarFrameL();
iEdwin->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,
                           CEikScrollBarFrame::EAuto);
iEdwin->ScrollBarFrame()->SetScrollBarManagement(CEikScrollBar::EVertical,
                             CEikScrollBarFrame::EFloating);
iEdwin->ScrollBarFrame()->SetScrollBarControlType(CEikScrollBar::EVertical,0);
iEdwin->ScrollBarFrame()->SetScrollBarBreadth(CEikScrollBar::EVertical,0);
iEdwin->SetExtent(TPoint(0,0), TSize(aRect.Width(),aRect.Height()));
_LIT(KText,"This is text1.\nThis is text2.\nThis is text3");
iEdwin->SetTextL(&KText);
iEdwin->SetWordWrapL( ETrue );

I guess you have to call the SetWordWrapL after setting the text.

Hope this helps you.

One problem in here that it does not put the linebreaks. It's not that easy to implement.

Regards,
shagor
  • Login to reply to this topic.