View Issue Details

IDProjectCategoryView StatusLast Update
0004196JEDI VCL00 JVCL Componentspublic2007-10-12 07:24
ReporterSurFan4711Assigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0004196: TJVListview crashes with "nil cannot be assigned to TFont"
DescriptionIf you do not create the TJvListItems via the CreateEnh constructor, Font (and Brush) do not get created, so the above Exception is raised in TJvListView.CustomDrawItem
Additional InformationI suggest:

1.) Testing, if Item is derived from TJvListItem and
2.) Checking if Items Font and Brush properties are not nil.

Here is my suggestion:


function TJvListView.CustomDrawItem(Item: TListItem;
  State: TCustomDrawState; Stage: TCustomDrawStage): Boolean;
begin
  if (Stage = cdPrePaint) and Assigned(Item) and (Item is TJvListItem) then
  begin
    if TJvListItem(Item).Font <> nil then
      Canvas.Font := TJvListItem(Item).Font;
    if ViewStyle in ViewStylesItemBrush then
      if TJvListItem(Item).Brush <> nil then
        Canvas.Brush := TJvListItem(Item).Brush;
    Canvas.Handle;
  end;

TagsNo tags attached.

Activities

obones

2007-10-12 07:23

administrator   ~0013926

You should not call any constructor on TJvListItem yourself, you should always get the one returned by JvListView.Items.Add

Issue History

Date Modified Username Field Change
2007-08-07 05:50 SurFan4711 New Issue
2007-10-12 07:23 obones Status new => resolved
2007-10-12 07:23 obones Resolution open => won't fix
2007-10-12 07:23 obones Assigned To => obones
2007-10-12 07:23 obones Note Added: 0013926