Clipping longText to Fit Screen

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: giridharn (20 May 2007)
Last edited: hamishwillee (20 Jul 2012)
Sometimes display text will be so long that it goes out of screen,in such case we can use ClipToFit() method to show ".." of the text.

Here, is the code to do so,

const CFont* myFont = iEikonEnv->DenseFont();
TBuf<100> buffer;
TInt aMaxWidthInPixels; //depending on your screen dimensions use this, for 176x208
//I use 100.
buffer.Copy(_L("BackStreet Boys Music tracks"));
AknTextUtils::ClipToFit(buffer,*myFont, aMaxWidthInPixels, AknTextUtils::EClipFromEnd,

Now use this "buffer" in your Drawtext() method.

This page was last modified on 20 July 2012, at 07:43.
40 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.