Different charsets for different TListItems ???
My app is displaying a list of available language modules; some may use
different character sets so I need to change the output depending on the
current language.
My list is a TListView, so I thought simply writing an
OnCustomDrawItem/OnCustomDrawSubItem would be sufficient as it is with
different font sizes, colors, etc.. The problem is that it doesn't work.
Attached is the code that is using the correct font name and size, but
not the correct character set (Delphi 4, SP3).
Is there another way to influence the character set a TListItem is drawn
with? Or can I send that Canvas font information to the ListView by
using some API function?
Btw: if I switch the whole form (thus also the TListView) to the correct
character set, the corresponding TListItem is displayed correctly, so
the data inside it is correct.
Thanks!
Patrick Kolla
procedure TformMain.lvLanguagesCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var l: TLanguage;
begin
lvLanguages.Canvas.Font.Color := clWindowText;
if Assigned(Item.Data) then begin
l := TLanguage(Item.Data);
lvLanguages.Canvas.Font.Name := l.FontName;
lvLanguages.Canvas.Font.Size := l.FontSize;
lvLanguages.Canvas.Font.Charset := l.FontCharset;
end else begin
lvLanguages.Canvas.Font.Name := formMain.Font.Name;
lvLanguages.Canvas.Font.Size := formMain.Font.Size;
lvLanguages.Canvas.Font.Charset := 0;
end;
end;
(I use the same code for OnCustomDrawSubItem where it doesn't work either)