Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Clipping longText to Fit Screen

From Wiki
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 07:43.
47 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.

×