View Issue Details

IDProjectCategoryView StatusLast Update
0004878JEDI VCL00 JVCL Componentspublic2009-09-22 16:58
ReporterBrianAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0004878: JvListview OnCustomDrawSubItem treats item.caption as a subitem
DescriptionWhen you use oncustomdrawsubitem to change the font of subitems, the item captions are treated like they were also subitems. Check screenshot for comparison (ListView on top, JvListView below)

http://img124.imageshack.us/img124/7900/20090730092736capture.png
Additional Informationprocedure TForm7.JvListView1CustomDrawSubItem(Sender: TCustomListView;
  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
  var DefaultDraw: Boolean);
begin
if (SubItem=1) then
begin
  Sender.Canvas.Font.Color := clRed;
end
else sender.Canvas.Font.Color := clBlue;

defaultdraw := true;
end;
TagsNo tags attached.

Activities

obones

2009-08-03 11:35

administrator   ~0015899

Please provide the zipped sources of a sample application showing this.

2009-08-26 22:20

 

listview test.zip (3,335 bytes)

Brian

2009-08-26 22:20

reporter   ~0016020

added zip

obones

2009-09-22 16:58

administrator   ~0016146

This is as designed, OnCustomDrawSubItem is called even for SubItem 0 because of Mantis 3908. See the JvListView file for an explanation at line 2108.
So you should change your code to this:

  if (SubItem=1) then
    Sender.Canvas.Font.Color := clRed
  else if (SubItem=2) then
    sender.Canvas.Font.Color := clBlue;

Issue History

Date Modified Username Field Change
2009-07-30 09:31 Brian New Issue
2009-08-03 11:35 obones Note Added: 0015899
2009-08-03 11:35 obones Status new => feedback
2009-08-26 22:20 Brian File Added: listview test.zip
2009-08-26 22:20 Brian Note Added: 0016020
2009-09-22 16:58 obones Note Added: 0016146
2009-09-22 16:58 obones Status feedback => resolved
2009-09-22 16:58 obones Resolution open => no change required
2009-09-22 16:58 obones Assigned To => obones