🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internationalization
Article #110

Re: Problem in displaying TListView items that have different character set

#110
From: Andrue Cope [TeamB]
Date: Thu, 06 Jan 2005 10:03
36 lines
2412 bytes
Hwah Shih Yiew wrote:

> Is there a way to display 2 list items that have different character
> set in a single TListView control?

Use owner drawing and render the text onto the component canvas
yourself. You might find the following template informative although
you will need to set the font character set first. We wrote this
because changing the font CharSet property for the parent component
didn't have any visible effect. In our case at least all the items will
have the same character set but I think that changing the CharSet in
this routine will allow you to have multiple items with different
character sets.

// Left offset is needed for drop down combo boxes.
template<typename TControlType>
  void ViewerUtils_ListBoxSimpleDrawItem( TControlType *     Control,
                                          TRect &            Rect,
                                          TOwnerDrawState    State,
                                          AnsiString const & ItemString,
                                          int     LeftOffset=0 )
{
  Control->Canvas->FillRect( Rect );

  if( State.Contains( odSelected ) )
    Control->Canvas->Font->Color=clHighlightText;
  else
    Control->Canvas->Font->Color=clWindowText;

  Control->Canvas->TextRect( Rect, LeftOffset, Rect.Top, ItemString );
}

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <41dd0d01$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41dd0289$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10297d,adc2385500da5c60
X-Google-Attributes: gid10297d,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: Problem in displaying TListView items that have different character set
Newsgroups: borland.public.cppbuilder.internationalization
References: <41dd0289$1@newsgroups.borland.com>
Date: Thu, 6 Jan 2005 10:03:12 +0000
User-Agent: XanaNews/1.17.1.2
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <41dd0d01$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105005825 217.207.223.34 (6 Jan 2005 02:03:45 -0800)
Lines: 36
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail