Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor asangamneheri's Avatar
    Join Date
    Mar 2003
    Posts
    108
    hi

    how do you change font in a listbox (CEikTextListBox). i know its to do with ItemDrawer, but how exactly does one do it?

    thanks,
    ash

  2. #2
    Regular Contributor maokkone's Avatar
    Join Date
    Mar 2003
    Posts
    371
    Hi,

    Read the page titled "Vertical text and icon listbox" from SDK Help (9200 SDK). There is quite good example about how to create a list box containing also how to set a font. The example is for CCknVerticalTextAndIconListBox, but it shouldn't differ much.

    Below the lines about setting the font.

    Best Regards,
    Marko / Forum Nokia

    --- code begins ---
    _LIT(KExampleListBoxTextFont,"Courier"); //Hardcoded name for required font

    //Create and set font spec
    TFontSpec fontSpec;
    fontSpec.iTypeface.iName=KExampleListBoxTextFont;
    fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
    fontSpec.iHeight=100;

    //Get the nearest matching font. iIconListFont is a CFont* member variable
    User::LeaveIfError(CCoeEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iIconListFont,fontSpec));
    (static_cast <CTextAndIconListBoxItemDrawerBase*> (View()->ItemDrawer()))->SetFont(iIconListFont);

    --- code ends ---

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
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