View Issue Details

IDProjectCategoryView StatusLast Update
0003908JEDI VCL00 JVCL Componentspublic2006-09-19 07:52
ReporterykamiAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.30 
Summary0003908: JvListView - Font breaks when Column Order is changed.
DescriptionWhen the FullDrag property is made true, and the leftmost column order is changed, Font becomes amusing. (ViewStyle = vsReport)

It is thought that the cause of this problem is in no call of the CustomDrawSubItem method when SubItem is 0. (in TCustomListView.CNNotify)

BDS 2006+XP SP2
Rev.10925
Additional InformationAn attached patch is dirty fix.
TagsNo tags attached.

Activities

2006-09-17 05:00

 

FontFix.patch (3,393 bytes)
*** Org\JvListView.pas	Fri Sep 15 01:06:06 2006
--- JvListView.pas	Sun Sep 17 19:32:40 2006
***************
*** 68,74 ****
  
    //  TJvSortMethod = (smAutomatic, smAlphabetic, smNonCaseSensitive, smNumeric, smDate, smTime, smDateTime, smCurrency);
    TJvOnProgress = procedure(Sender: TObject; Progression, Total: Integer) of object;
!   TJvListViewCompareGroupEvent = procedure(Sender: TObject; Group1, Group2: TJvListViewGroup; var Compare: Integer) of object; 
  
    TJvListItems = class(TListItems, IJvAppStorageHandler, IJvAppStoragePublishedProps)
    private
--- 68,74 ----
  
    //  TJvSortMethod = (smAutomatic, smAlphabetic, smNonCaseSensitive, smNumeric, smDate, smTime, smDateTime, smCurrency);
    TJvOnProgress = procedure(Sender: TObject; Progression, Total: Integer) of object;
!   TJvListViewCompareGroupEvent = procedure(Sender: TObject; Group1, Group2: TJvListViewGroup; var Compare: Integer) of object;
  
    TJvListItems = class(TListItems, IJvAppStorageHandler, IJvAppStoragePublishedProps)
    private
***************
*** 377,382 ****
--- 377,383 ----
      procedure WMNCCalcSize(var Msg: TWMNCCalcSize); message WM_NCCALCSIZE;
      procedure LVMDeleteColumn(var Msg: TMessage); message LVM_DELETECOLUMN;
      procedure LVMInsertColumn(var Msg: TMessage); message LVM_INSERTCOLUMN;
+     procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
  
      procedure InsertItem(Item: TListItem); override;
      function IsCustomDrawn(Target: TCustomDrawTarget; Stage: TCustomDrawStage): Boolean; {$IFDEF COMPILER6_UP} override; {$ENDIF}
***************
*** 466,472 ****
    UnitVersioning: TUnitVersionInfo = (
      RCSfile: '$URL: https://svn.sourceforge.net:443/svnroot/jvcl/trunk/jvcl/run/JvListView.pas $';
      Revision: '$Revision: 10925 $';
!     Date: '$Date: 2006-09-01 17:49:37 +0900 (金, 01 9 2006) $';
      LogPath: 'JVCL\run'
      );
  {$ENDIF UNITVERSIONING}
--- 467,473 ----
    UnitVersioning: TUnitVersionInfo = (
      RCSfile: '$URL: https://svn.sourceforge.net:443/svnroot/jvcl/trunk/jvcl/run/JvListView.pas $';
      Revision: '$Revision: 10925 $';
!     Date: '$Date: 2006-09-01 17:49:37 +0900 (釁E 01 9 2006) $';
      LogPath: 'JVCL\run'
      );
  {$ENDIF UNITVERSIONING}
***************
*** 957,962 ****
--- 958,986 ----
      FOnVerticalScroll(Self);
  end;
  
+ procedure TJvListView.CNNotify(var Message: TWMNotify);
+ begin
+ 
+   with Message do
+     if NMHdr^.code = NM_CUSTOMDRAW then
+     begin
+       with PNMCustomDraw(NMHdr)^ do
+       begin
+        if (dwDrawStage and CDDS_SUBITEM <> 0) and
+           (PNMLVCustomDraw(NMHdr)^.iSubItem = 0) then
+        begin
+          PNMLVCustomDraw(NMHdr)^.iSubItem := -1;
+          inherited;
+          PNMLVCustomDraw(NMHdr)^.iSubItem := 0;
+          Exit;
+        end;
+       end;
+     end;
+ 
+  inherited;
+ 
+ end;
+ 
  procedure TJvListView.ColClick(Column: TListColumn);
  type
    TParamSort = record
***************
*** 2099,2104 ****
--- 2123,2133 ----
  function TJvListView.CustomDrawSubItem(Item: TListItem; SubItem: Integer;
    State: TCustomDrawState; Stage: TCustomDrawStage): Boolean;
  begin
+   // Even if TListView and difference SubItem are 0,
+   // CustomDrawSubItem is generated.
+   if SubItem = -1 then
+     SubItem := 0;
+ 
    if (Stage = cdPrePaint) and Assigned(Item) then
    begin
      Canvas.Font := TJvListItem(Item).Font;
FontFix.patch (3,393 bytes)

obones

2006-09-17 09:30

administrator   ~0010137

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

2006-09-17 09:58

 

JvListViewFontProblem.ZIP (7,102 bytes)

ykami

2006-09-17 10:18

reporter   ~0010138

I Attached project that was able to reproduce it.

Steps to Reproduce:
1: Execute Project1.exe
2: Drag Column1 at the right of Column2.

This problem doesn't occur in the state of default of TListView.
However, when the font of Canvas is changed in OnCustomDrawItem/SubItem, I think that it occurs.

Issue History

Date Modified Username Field Change
2006-09-17 05:00 ykami New Issue
2006-09-17 05:00 ykami File Added: FontFix.patch
2006-09-17 09:30 obones Note Added: 0010137
2006-09-17 09:30 obones Status new => feedback
2006-09-17 09:58 ykami File Added: JvListViewFontProblem.ZIP
2006-09-17 10:18 ykami Note Added: 0010138
2006-09-19 07:52 obones Status feedback => resolved
2006-09-19 07:52 obones Fixed in Version => Daily / SVN
2006-09-19 07:52 obones Resolution open => fixed
2006-09-19 07:52 obones Assigned To => obones