×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    108

    how to change font in listbox

    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
    Join Date
    Mar 2003
    Posts
    371

    RE: how to change font in listbox

    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
  •  
×