Namespaces
Variants
Actions

Clipping longText to Fit Screen

Jump to: navigation, search
Article Metadata

Article
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,
KDefaultClipWidth,_L("..."));

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

This page was last modified on 20 July 2012, at 10:43.
98 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved