×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    9

    font for listbox, 3rd ed.

    Hi

    I tried to change font used in listbox in Series60 3.0 MR, without success.
    I tried following things

    (A)
    iList->ItemDrawer()->SetFont(LatinPlain12());

    (B)
    iList->ItemDrawer()->ColumnData()->SetColumnFontL(TInt(1),LatinPlain12());

    both in container class's constructL, or in draw functions, without success.

    Another trial was using custom listbox which inherited CAknSingleStyleListBox and CColumListBoxItemDrawer. I used

    (C)
    columnData->SetColumnFontL( 1, LatinPlain12());
    and also

    (D)
    iItemDrawer = new (ELeave) CCustomListItemDrawer(*this, Model(), LatinPlain12(), columnData);

    inside createItemDrawer, which all failed.

    The only thing and most strange thing is that if I use
    iList->ItemDrawer()->ColumnData()->SetColumnFontForRowL(1, 1, LatinPlain12()) inside container's constructL it actually changed font for second Row!! (But I want to change entire fonts. changing all rows one by one is... does not look good)

    I searched the entire forum with font and listbox, but there seems to be some confusion around this. When I tested in 2nd Ed, SetColumnFontL worked fine but in 3rd, no effect. So there is series of try this - no effect thread... no conclusion for 3rd ed .

    Can there be any way for '3Rd Ed, changing font for listbox' ?


    Regards,
    Tay

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    Braunschweig
    Posts
    46

    Re: font for listbox, 3rd ed.

    With TCharFormat and TCharFormatMask you can change font, font size and font colour inside the listbox. But not the line spacing of the box.
    Please, use the search function in the forum, you will find sample code.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    9

    Re: font for listbox, 3rd ed.

    Isnt' TCharFormat only applicable for richtext or edit window? I can't find any use case for listbox. Anyway, applying some sample code found in the forum didn't change anything.
    BTW, this is nearly similar to
    http://discussion.forum.nokia.com/fo...t=font+listbox
    which you posted in the forum. Did you find answer for this?

    Also
    http://discussion.forum.nokia.com/fo...t=font+listbox
    http://discussion.forum.nokia.com/fo...t=font+listbox
    http://discussion.forum.nokia.com/fo...t=font+listbox
    all these and other questions are still the same, without any conclusion. Only success reported seems to be on S60 2Ed.

    Regards,
    Tay

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    Braunschweig
    Posts
    46

    Re: font for listbox, 3rd ed.

    Sorry, it is correct. TCharFormat is only applicable for richtext.

    I was fighting with both, changing font and size in an edwin as well as the listbox.
    But both is possible in S60 3rd edition. Changing a listbox needs a little bit more effort. You have to derive you own listbox (subclass) and overwrite the DrawActualItem member function at the listbox's ItemDrawer.

    Here you can find a good guide for UIQ:
    http://www.antonypranata.com/article...nglistbox.html

    For S60 you have to replace
    const MDesCArray* itemArray = iListBox.Model()->ItemTextArray();
    with
    const MDesCArray* itemArray = iListBoxModel->MatchableTextArray();
    and you can change font, linespacing or what every you want.

    I took a CAknSingleGraphicStyleListBox and modified it in a way to get more lines on the display. Font was changed to CEikonEnv::Static()->DenseFont().

    Regards Holler

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    35

    Re: font for listbox, 3rd ed.

    hi holler,

    for CAknSingleGraphicStyleListBox ... r u using CListItemDrawer?
    ABC

  6. #6
    Registered User
    Join Date
    Mar 2003
    Location
    Braunschweig
    Posts
    46

    Re: font for listbox, 3rd ed.

    Yes, the derived CColumnListBoxItemDrawer. Here is my header file:

    #include <aknlists.h>
    #include <eikclbd.h>
    class CMyColumnListBoxItemDrawer;
    class CMyListbox : public CAknSingleGraphicStyleListBox
    {
    public:
    CMyListbox();
    virtual ~CMyListbox();
    void SizeChanged();
    virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
    protected:
    virtual void CreateItemDrawerL();
    CMyColumnListBoxItemDrawer* imydr;
    };

    class CMyColumnListBoxItemDrawer : public CColumnListBoxItemDrawer
    {
    public:
    CMyColumnListBoxItemDrawer(MTextListBoxModel* aTextListBoxModel, const CFont* aFont, CColumnListBoxData* aColumnData);
    virtual ~CMyColumnListBoxItemDrawer();
    virtual void DrawActualItem(TInt aItemIndex, const TRect& aActualItemRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool, TBool aItemIsSelected)const;
    void SetFindBox(CAknSearchField* aFindBox);
    CAknSearchField* iFindBox;
    private:
    void CalculateMaxIconSize();
    MTextListBoxModel* iListBoxModel;
    CArrayPtr<CGulIcon>* iIconArray;
    TSize iMaxIconSize;
    };
    Maybe it is possible to save the reimplemtation of DrawActualItem when you just want to change one font to an another with the same size. Try to use members of the ListItemDrawer, e.g. CTextListItemDrawer::SetFont(...).

    Regards, Holler

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    9

    Re: font for listbox, 3rd ed.

    Even using custom Itemdrawer failed to change the font including SetFont etc. Changing it inside it, outside it, changing iFont directly, .... all failed. I'm curious what those all font settings are doing...

    At least you can change the color.
    void CCustomListItemDrawer::DrawActualItem(TInt aItemIndex,
    const TRect& aActualItemRect, TBool aItemIsCurrent,
    TBool aViewIsEmphasized, TBool aViewIsDimmed,
    TBool aItemIsSelected) const
    {

    ((CListItemDrawer *)this)->SetTextColor(KRgbGreen);

    CColumnListBoxItemDrawer::DrawActualItem(aItemIndex, aActualItemRect, aItemIsCurrent,
    aViewIsEmphasized, aViewIsDimmed,aItemIsSelected);
    }

    this works... but no font related thing works...

    Actually I wanted to save S60 DrawActualItem implementation but it does not seem to allow me to change font...

    Tay

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    35

    Re: font for listbox, 3rd ed.

    hi taycho1

    can u tell me why it gives KERN-EXEC 3 panic when it execute this line

    CColumnListBoxItemDrawer::DrawActualItem(aItemIndex, aActualItemRect, aItemIsCurrent,
    aViewIsEmphasized, aViewIsDimmed,aItemIsSelected);


    thanks in advance.
    ABC

Similar Threads

  1. How to get the name of the used font
    By chrishawaii in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-06-22, 06:55
  2. Device font in S60 Platform SDK 3rd ED
    By jiipee63 in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2006-10-02, 10:09
  3. [announce] full screen dot amtrix scroller
    By xchip in forum Symbian
    Replies: 7
    Last Post: 2006-06-08, 22:17
  4. New font 6600
    By hamishw in forum Symbian
    Replies: 0
    Last Post: 2005-04-10, 10:59

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×