Search code examples
scrollsymbians60tickerceiklabel

Symbian S60 - Scrolling text in a CEikLabel


I have a single line CEikLabel in my application that needs to scroll text.

The simple solution that comes to mind (but possibly naive) would be something like..

[begin pseduo code]

 on timer.fire {
  set slightly shifted text in label
  redraw label
 }
 start timer

[end pseudo code]

Using a CPeriodic class as the timer and label.DrawDeferred() on each update.

Do you think this is the best way, it may be rather inefficient redrawing the label two or three times a second.. but is there any other way?

Thanks :)


Solution

  • I've seen the timer based solution used for scrolling item names in listboxes.

    A couple of things to watch out for are that it could flicker a bit while scrolling and that you need to make sure the text you put on the label is not too long, otherwise it will automatically clip the string and add an elipsis (...)

    Use TextUtils::ClipToFit to get a string that fits on the label and remove the elipsis it adds before putting the text on the label (search for KTextUtilClipEndChar in your clipped string). You will need to work out how many characters to skip at the beginning of the string before passing it to the clip function.