View Issue Details

IDProjectCategoryView StatusLast Update
0007059LazarusWidgetsetpublic2013-10-07 19:05
ReporterBenito van der Zander Assigned ToZeljan Rikalo  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version0.9.17 (SVN) 
Fixed in Version0.9.27 (SVN) 
Summary0007059: TListView: OnCustomDraw event
DescriptionHere is a patch for Win32 which will add the events OnCustomDraw, OnCustomItemDraw and OnCustomSubItemDraw and the canvas property to the TListView componte, like they are in Delphi.
It also gives the Items a mehode DisplayRect and DisplactRectSubItem for receiving the position of the items in the ListView.
TagsListView
Fixed in Revision20273,43135,43157
LazTarget1.2
WidgetsetGTK 2, Win32/Win64, QT
Attached Files

Relationships

parent of 0013847 closedPaul Ishenin Patches Fix for owner drawn TListView on Windows 
related to 0009255 closedVincent Snijders Lazarus Cant' color columns in ListView 
related to 0014071 closedZeljan Rikalo Lazarus TCheckListBox do not use OnDrawItem 
related to 0025149 closedZeljan Rikalo Lazarus TListView missing OwnerDraw property 
related to 0024941 assignedZeljan Rikalo Lazarus TListView.onCustomDrawSubItem 

Activities

2006-06-18 19:21

 

listview.patch (14,844 bytes)   
Index: interfaces/win32/win32callback.inc
===================================================================
--- interfaces/win32/win32callback.inc	(revision 9438)
+++ interfaces/win32/win32callback.inc	(working copy)
@@ -754,7 +754,66 @@
       SetWin32SizePoint(MaxWidth, MaxHeight, MinMaxInfo.ptMaxTrackSize);
     end;
   end;
+  
+  procedure HandleListViewCustomDraw(listView: TListView);
+    type
+         TLVDrawInfo = Record
+                         hdr          : NMHDR;
+                         dwDrawStage  : DWORD;
+                         hdc          : HDC;
+                         rc           : TRECT;
+                         dwItemSpec   : DWORD;
+                         uItemState   : UINT;
+                         lItemlParam  : longint;
+				  	     clrText,clrTextBk:COLORREF;
+                         iSubItem     :longint;
+                       END;
+		 PLVDrawInfo=^TLVDrawInfo;
+    function convState(const state:uint): TCustomDrawState;
+	begin
+	  convState:=[];
+	  if state and $008{CDIS_CHECKED} <> 0 then include(convState,cdsChecked);
+	  if state and $020{CDIS_DEFAULT} <> 0 then include(convState,cdsDefault);
+	  if state and $004{CDIS_DISABLED} <> 0 then include(convState,cdsDisabled);
+	  if state and $010{CDIS_FOCUS} <> 0 then include(convState,cdsFocused);
+	  if state and $002{CDIS_GRAYED} <> 0 then include(convState,cdsGrayed);
+	  if state and $040{CDIS_HOT} <> 0 then include(convState,cdsHot);
+	  if state and $100{CDIS_INDETERMINATE} <> 0 then include(convState,cdsIndeterminate);
+	  if state and $080{CDIS_MARKED} <> 0 then include(convState,cdsMarked);
+	  if state and $001{CDIS_SELECTED} <> 0 then include(convState,cdsSelected);
+	end;
+  var defaultDraw: boolean;
+      drawInfo:PLVDrawInfo;
+  begin
+    defaultDraw:=true;
+    drawInfo:=PLVDrawInfo(lmnotify.NMHdr );
+    lmnotify.result:=0{CDRF_DODEFAULT};
+    WinProcess:=false;
+    case drawInfo^.dwDrawStage of
+      $1{CDDS_PREPAINT}: begin
+                           if assigned(listView.OnCustomDraw) then
+                             listView.OnCustomDraw(listView,drawInfo^.rc,cdPrePaint,defaultDraw);
+                           if not defaultDraw then lmnotify.result:=$4{CDRF_SKIPDEFAULT};
+                           if assigned(listView.OnCustomDrawItem) or assigned(listView.OnCustomDrawSubItem) then
+                             lmnotify.result:=lmnotify.result or $20{CDRF_NOTIFYITEMDRAW};
+                         end;
+	  $10001{CDDS_ITEMPREPAINT}: begin
+                           if assigned(listView.OnCustomDrawItem) then
+                             listView.OnCustomDrawItem(listView,listView.Items[drawInfo^.dwItemSpec],
+                                                       convState(drawInfo^.uItemState),cdPrePaint,defaultDraw);
+                           if not defaultDraw then lmnotify.result:=$4{CDRF_SKIPDEFAULT};
+                           if assigned(listView.OnCustomDrawSubItem) and (listView.viewStyle=vsReport) then
+                             lmnotify.result:=lmnotify.result or $20{CDRF_NOTIFYSUBITEMDRAW = CDRF_NOTIFYITEMDRAW};
+                         end;
+	  $30001{CDDS_SUBITEM or CDDS_ITEMPREPAINT}: begin
+                           if assigned(listView.OnCustomDrawSubItem) then
+                             listView.OnCustomDrawSubItem(listView,listView.Items[drawInfo^.dwItemSpec],drawInfo^.iSubItem,
+                                                          convState(drawInfo^.uItemState),defaultDraw);
+                           if not defaultDraw then lmnotify.result:=$4{CDRF_SKIPDEFAULT};
+                         end;
+	end;
 
+  end;
 Begin
   Assert(False, 'Trace:WindowProc - Start');
 
@@ -1468,6 +1527,11 @@
               ShowHideTabPage(HWndFrom, True);
               idFrom := Windows.SendMessage(HWndFrom, TCM_GETCURSEL, 0, 0);
             end;
+            {NM_CUSTOMDRAW}-12:
+	          begin
+	            if (WindowInfo^.WinControl<>nil) and (WindowInfo^.WinControl is TListView) then
+                   HandleListViewCustomDraw(TListView(WindowInfo^.WinControl));
+            end;
           end;
         end;
       end;
Index: interfaces/win32/win32wscustomlistview.inc
===================================================================
--- interfaces/win32/win32wscustomlistview.inc	(revision 9438)
+++ interfaces/win32/win32wscustomlistview.inc	(working copy)
@@ -349,6 +349,20 @@
   ListView_EnsureVisible(ALV.Handle, AIndex, Ord(PartialOK));
 end;
 
+class function TWin32WSCustomListView.ItemDisplayRect(const ALV: TCustomListView; const AIndex, SubItem: Integer;Code: TDisplayCode):TRect; 
+const DisplayCodes:array[TDisplayCode] of DWORD=(LVIR_BOUNDS, LVIR_ICON, LVIR_LABEL, LVIR_SELECTBOUNDS);
+VAR mes:uint;
+begin
+  if subItem=0 then mes:=LVM_GETITEMRECT
+  else begin
+    mes:=$1000+56{LVM_GETSUBITEMRECT};
+    if code=drSelectBounds then 
+      code:=drBounds;
+  end;
+  result.top:=subItem;
+  result.left:=DisplayCodes[code];
+  SendMessage(ALV.Handle,mes,AIndex,lparam(@result));
+end;
 ////////////////////////////////////////////////////////////////////////////////
 // LV code
 ////////////////////////////////////////////////////////////////////////////////
Index: interfaces/win32/win32wscomctrls.pp
===================================================================
--- interfaces/win32/win32wscomctrls.pp	(revision 9438)
+++ interfaces/win32/win32wscomctrls.pp	(working copy)
@@ -107,6 +107,7 @@
     class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
     class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
     class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
+    class function ItemDisplayRect(const ALV: TCustomListView; const AIndex, SubItem: Integer;Code: TDisplayCode):TRect; override;
   
     // lv
     class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override;
Index: comctrls.pp
===================================================================
--- comctrls.pp	(revision 9438)
+++ comctrls.pp	(working copy)
@@ -566,6 +566,8 @@
   
   TListItemFlag = (lifDestroying, lifCreated);
   TListItemFlags = set of TListItemFlag;
+
+  TDisplayCode = (drBounds, drIcon, drLabel, drSelectBounds);
   
   { TListItem }
 
@@ -603,6 +605,8 @@
     destructor Destroy; override;
     procedure Delete;
     procedure MakeVisible(PartialOK: Boolean);
+    function DisplayRect(Code: TDisplayCode): TRect;
+    function DisplayRectSubItem(subItem: integer;Code: TDisplayCode): TRect;
 
     property Caption : String read FCaption write SetCaption;
     property Cut: Boolean index Ord(lisCut) read GetState write SetState;
@@ -615,8 +619,7 @@
     property Owner: TListItems read FOwner;
     property Selected: Boolean index Ord(lisSelected) read GetState write SetState;
     property SubItems: TStrings read GetSubItems write SetSubItems;
-    property SubItemImages[const AIndex: Integer]: Integer
-      read GetSubItemImages write SetSubItemImages;
+    property SubItemImages[const AIndex: Integer]: Integer read GetSubItemImages write SetSubItemImages;
   end;
 
 
@@ -753,6 +756,15 @@
   TLVInsertEvent = TLVDeletedEvent;
   TLVSelectItemEvent = procedure(Sender: TObject; Item: TListItem;
                                  Selected: Boolean) of object;
+  //currently the draw events are only called from the win32 interface
+  TCustomDrawEvent = procedure(Sender: TObject; const ARect: TRect; 
+                                Stage: TCustomDrawStage; var DefaultDraw: Boolean) of object;
+  TLVDrawItemEvent = procedure(Sender: TCustomListView; Item: TListItem; 
+                                State: TCustomDrawState; Stage: TCustomDrawStage; 
+                                var DefaultDraw: Boolean) of object;
+  TLVDrawSubItemEvent=procedure(Sender: TCustomListView; Item: TListItem; 
+                                 SubItem: Integer; State: TCustomDrawState;
+                                 var DefaultDraw: Boolean) of object;
 
   TListViewProperty = (
     lvpAutoArrange,
@@ -816,6 +828,9 @@
     FOnDeletion: TLVDeletedEvent;
     FOnInsert: TLVInsertEvent;
     FOnSelectItem: TLVSelectItemEvent;
+    FOnCustomDraw:TCustomDrawEvent;
+    FOnCustomDrawItem:TLVDrawItemEvent;
+    FOnCustomDrawSubItem: TLVDrawSubItemEvent;
     FProperties: TListViewProperties;
     function GetBoundingRect: TRect;
     function GetColumnFromIndex(AIndex: Integer): TListColumn;
@@ -860,6 +875,7 @@
 
   protected
     procedure InitializeWnd; override;
+    procedure DestroyWnd; override;
     procedure Change(AItem: TListItem; AChange: Integer); dynamic;
     procedure ColClick(AColumn: TListColumn); dynamic;
 
@@ -904,6 +920,9 @@
     property OnDeletion: TLVDeletedEvent read FOnDeletion write FOnDeletion;
     property OnInsert: TLVInsertEvent read FOnInsert write FOnInsert;
     property OnSelectItem: TLVSelectItemEvent read FOnSelectItem write FOnSelectItem;
+    property OnCustomDraw: TCustomDrawEvent read FOnCustomDraw write FOnCustomDraw;
+    property OnCustomDrawItem: TLVDrawItemEvent read FOnCustomDrawItem write FOnCustomDrawItem;
+    property OnCustomDrawSubItem: TLVDrawSubItemEvent read FOnCustomDrawSubItem write FOnCustomDrawSubItem;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -989,6 +1008,9 @@
     property OnKeyDown;
     property OnDeletion;
     property OnSelectItem;
+    property OnCustomDraw;
+    property OnCustomDrawItem;
+    property OnCustomDrawSubItem;
   end;
 
   TProgressBarOrientation = (pbHorizontal, pbVertical, pbRightToLeft, pbTopDown);
Index: include/customlistview.inc
===================================================================
--- include/customlistview.inc	(revision 9438)
+++ include/customlistview.inc	(working copy)
@@ -28,6 +28,9 @@
   FSortType := stNone;
   FSortColumn := 0;
   FOnCompare := nil;
+  FOnCustomDraw := nil;
+  FOnCustomDrawItem := nil;
+  FOnCustomDrawSubItem := nil;
   FImageChangeLink := TChangeLink.Create;
   FImageChangeLink.OnChange := @ImageChanged;
   FSelected := nil;
@@ -37,6 +40,8 @@
   SetInitialBounds(0,0,100,90);
   ParentColor := False;
   Color := clWindow;  
+  FCanvas := TControlCanvas.Create;
+  TControlCanvas(FCanvas).Control := Self;
   FProperties := [lvpColumnClick, lvpHideSelection, lvpShowColumnHeaders];
 end;
 
@@ -77,11 +82,13 @@
 begin
   nm := PNMListView(AMessage.NMHdr);
   if nm^.iItem>=Items.Count then exit;
-
-  case AMessage.NMHdr^.code of
-//    HDN_TRACK:
-//    NM_CUSTOMDRAW:
-//    LVN_BEGINDRAG:
+  //remark: NMHdr^.code is normally unhanged by the win32 interface, so the others
+  //        maps there codes to the of win32
+  case AMessage.NMHdr^.code of 
+//  HDN_TRACK:
+//  NM_CUSTOMDRAW: //Custom Drawing is handled direct from the interfaces 
+                   //(at least win32 does so)
+//  LVN_BEGINDRAG:
     LVN_DELETEITEM: begin
       Item := FListItems[nm^.iItem];
       if FSelected = Item then
@@ -392,6 +399,7 @@
 begin
   // Better destroy the wincontrol (=widget) first. So wo don't have to delete
   // all items/columns and we won't get notifications for each.
+  FreeAndNil(FCanvas);
   inherited Destroy;
   FreeAndNil(FColumns);
   FreeAndNil(FImageChangeLink);
@@ -399,6 +407,20 @@
 end;
 
 {------------------------------------------------------------------------------
+   TCustomListView DestroyWnd
+   Params: None
+   Result: none
+
+   Frees the canvas
+ ------------------------------------------------------------------------------}
+procedure TCustomListView.DestroyWnd; 
+begin
+  if FCanvas<>nil then
+    TControlCanvas(FCanvas).FreeHandle;
+  inherited DestroyWnd;
+end;
+
+{------------------------------------------------------------------------------
    TCustomListView BeginUpdate
    Params: None
    Result: none
Index: include/listitem.inc
===================================================================
--- include/listitem.inc	(revision 9438)
+++ include/listitem.inc	(working copy)
@@ -548,3 +548,24 @@
   if (AValue = nil) and (FSubItems = nil) then Exit;
   SubItems.Assign(AValue);
 end;
+
+{------------------------------------------------------------------------------}
+{   TListItem DisplayRect                                                      }
+{------------------------------------------------------------------------------}
+function TListItem.DisplayRect(Code: TDisplayCode): TRect;
+begin
+  result:=TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemDisplayRect(
+                                        FOwner.FOwner, GetIndex, 0, code);
+end;
+
+{------------------------------------------------------------------------------}
+{   TListItem DisplayRectSubItem                                               }
+{   The same as DisplayRect, except that it works for the sub items in the     }
+{   tecord view                                                                }
+{   If subItem = 0 then it will should return DisplayRect(code)                }
+{------------------------------------------------------------------------------}
+function TListItem.DisplayRectSubItem(subItem: integer;Code: TDisplayCode): TRect;
+begin
+  result:=TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemDisplayRect(
+                                       FOwner.FOwner, GetIndex, subItem, code);
+end;
Index: widgetset/wscomctrls.pp
===================================================================
--- widgetset/wscomctrls.pp	(revision 9438)
+++ widgetset/wscomctrls.pp	(working copy)
@@ -98,6 +98,7 @@
     class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); virtual;
     class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); virtual;
     class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); virtual;
+    class function ItemDisplayRect(const ALV: TCustomListView; const AIndex, SubItem: Integer;Code: TDisplayCode):TRect; virtual;
     
     // LV
     class procedure BeginUpdate(const ALV: TCustomListView); virtual;
@@ -309,6 +310,10 @@
 begin
 end;
 
+class function TWSCustomListView.ItemDisplayRect(const ALV: TCustomListView; const AIndex, SubItem: Integer;Code: TDisplayCode):TRect;
+begin
+end;
+
 class procedure TWSCustomListView.BeginUpdate(const ALV: TCustomListView);
 begin
 end;
listview.patch (14,844 bytes)   

Vincent Snijders

2006-06-19 08:08

manager   ~0008171

Thanks for the patch. I glanced at the diff and have the following (small) remarks:

* Use PascalCase (not camelCase) for all identifiers, also for local variables and parameters.

* If some windows constants are missing, add them to interfaces\win32\winext.pas. Consider making a patch for the windows unit and submit that too, so it will be there for future versions.

2006-06-22 20:34

 

winext.patch (1,821 bytes)   
Index: winext.pas
===================================================================
--- winext.pas	(revision 9476)
+++ winext.pas	(working copy)
@@ -42,6 +42,19 @@
   { Pointer to @link(COMBOBOXINFO) }
   PComboBoxInfo = ^COMBOBOXINFO;
 
+  TNMLVCustomDraw = Record
+                   hdr          : NMHDR;
+                   dwDrawStage  : DWORD;
+                   hdc          : HDC;
+                   rc           : TRECT;
+                   dwItemSpec   : DWORD;
+                   uItemState   : UINT;
+                   lItemlParam  : longint;
+				   clrText,clrTextBk:COLORREF;
+                   iSubItem     :longint;
+                END;
+  PNMLVCustomDraw=^TNMLVCustomDraw;
+
 { Win32 API constants not included in windows.pp }
 Const
   { Recommended modal-dialog style }
@@ -108,7 +121,8 @@
   LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55;
   LVM_SETHOVERTIME             = LVM_FIRST + 71;
   LVM_GETHOVERTIME             = LVM_FIRST + 72;
-
+  LVM_GETSUBITEMRECT           = LVM_FIRST + 56;
+  
   LVS_TYPEMASK = LVS_ICON  or LVS_SMALLICON or LVS_LIST or LVS_REPORT;
 
   // Comctl32 version:
@@ -142,6 +156,28 @@
   LVS_EX_SNAPTOGRID       = $00080000;
   LVS_EX_SIMPLESELECT     = $00100000;
   
+  //state information for common control items (used for listview)
+	CDIS_CHECKED=$008;
+	CDIS_DEFAULT=$020;
+	CDIS_DISABLED=$004;
+	CDIS_FOCUS=$010;
+  CDIS_GRAYED=$002;
+	CDIS_HOT=$040;
+	CDIS_INDETERMINATE=$100;
+	CDIS_MARKED=$080;
+	CDIS_SELECTED=$001;
+  
+  //custom draw event stage information
+  CDDS_PREPAINT=$1;
+  CDDS_ITEMPREPAINT=$10001;
+  CDDS_SUBITEM=$20000;
+  
+  //values returned by an custom draw event
+  CDRF_DODEFAULT=0;
+  CDRF_SKIPDEFAULT=$4;
+  CDRF_NOTIFYITEMDRAW=$20;
+  CDRF_NOTIFYSUBITEMDRAW=$20;
+  
 // progressbar
   PBM_SETRANGE32          = 1030;
 
winext.patch (1,821 bytes)   

2006-06-25 12:52

 

listview.patch_new (29,563 bytes)

Benito van der Zander

2006-06-25 13:17

reporter   ~0008220

Here (listview.patch_new) is another oatch for the TListView component.
It corrects some mistakes of the old one (There I have implemented the events like they are described in the D4 help, not like they are actually in Delphi realized), and adds the checked property to list items.

Benito van der Zander

2006-08-03 23:44

reporter   ~0008599

My listview patches doesn't work with the newest source from SVN, because DeliverMessage seems to override the result in the lmnotify record.
A workaround is to set lmnotify.msg on lm_null in the HandleListViewCustomDraw sub procedure, so that DeliverMessage will never be called, but I don't know which side effects this has.
When will the patch be in the SVN system?

Mattias Gaertner

2006-08-24 01:01

manager   ~0008748

The LCL must always check HandleAllocated before accessing the widgetsets.
IMO the patch is an improvement and should be applied. But it only contains windows stuff, so it would be better if a windows devel could apply it.
If they don't have the time, I will do it.

Marc Weustink

2006-08-30 01:46

administrator   ~0008815

Last edited: 2006-08-30 01:48

Applied modified patch in r9770

It is that the patch for win32callback failed and I decided to process that manually as last, otherwise this patch was never committed !

I adapted the patch at several places to keep it in style with other code, but that is a minor.

Some major issues:
* never ever cast a integer result wich you don't control to a bool. The safest way to convert is "Result := SomeIntResult <> 0". When casting, it completely depends on the internal routines how a boolean is evaluated (<> 0 or =-1)

* Widgetset methods always should check if a wincontrol has a handle. If not, you may enter an endles loop.

* (if I noticed this one first, It never got comitted)
Eventhandlers should not be called from the interface (period)
Either the customdraw message should have passed to TCustomListView (to be compatible with existing delphi code)
or a HandleCustomDraw method should have been added to TCustomListView

* When calling FonEvent handlers, it is a good thing to do this through a protected virtual DoEvent, so that descendent classes can override this.


I'll see if I can move the code this week.

Vincent Snijders

2006-08-30 21:45

manager   ~0008818

I think the patch (or its changes) has some side effects:

If you do Components -> Open loaded packages, lazarus crashes:

TApplication.HandleException Access violation
  Stack trace:
  $004600EA HANDLELISTVIEWCUSTOMDRAW, line 821 of win32callback.inc
  $0045F412 WINDOWPROC, line 1575 of win32callback.inc
  $77D18734 line 351 of WinExt.pas
  $77D18816 line 351 of WinExt.pas
  $77D1B4C0 line 351 of WinExt.pas
  $77D1B50C line 351 of WinExt.pas
  $7C90EAE3 line 351 of WinExt.pas
  $77D1B903 line 351 of WinExt.pas
  $773AAAA3 line 351 of WinExt.pas
  $773AB009 line 351 of WinExt.pas
  $773DD06C line 351 of WinExt.pas
  $773DE4C6 line 351 of WinExt.pas
  $773E0DDA line 351 of WinExt.pas
  $77D18734 line 351 of WinExt.pas
  $77D18816 line 351 of WinExt.pas
  $77D1C63F line 351 of WinExt.pas
  $77D1E905 line 351 of WinExt.pas

Marc Weustink

2006-08-31 17:24

administrator   ~0008820

Fixed :)
(I placed a failed chunk at the wrong location)

Vincent Snijders

2006-08-31 21:45

manager   ~0008825

No more crashes. Thanks.

Benito van der Zander

2006-09-10 21:08

reporter   ~0008895

I had written the HandleListViewCustomDraw procedure to win32callback because I doesn't know in which way the other interfaces would handle the event, and so I doesn't wanted to make many changes.

Actually there are some more mistakes in my old patch:
At first tbe CustomDrawItem-events are not called, because the DeliverMessage procedure still seems to eat the result value. (perhaps that is only because of a change somewhere else in the LCL I have made on my system, but I don't think so) (see an earlier note).
Then a change of the canvas colors doesn't change the colors the items are drawn in like in Delphi. I send in a patch for this and hope that at least this small change fit the coding style.

2006-09-10 21:08

 

listview.patch3 (563 bytes)

Vincent Snijders

2006-09-24 11:23

manager   ~0009063

Marc, anything to be done still?

haword

2006-10-03 13:41

reporter   ~0009197

version in SVN not call OnCustomDrawItem and OnCustomDrawSubItem

Vincent Snijders

2006-11-25 13:27

manager   ~0009975

Pathches have been applied, but this doesn't implement the feature completely.

I set the target to post 1.0, until new patches arrive.

Benito van der Zander

2008-09-10 14:16

reporter   ~0022111

The patch listview.patch3 was not applied.
It would have fixed some of the issues in 0009255.

Actually there is a bug in this patch file: the color properties should be wrapped in ColorToRgb-calls.
And it could be useful to write whole if-statement also to the next case-branch (for the subitem).

Vincent Snijders

2009-05-28 09:22

manager   ~0028094

Please test and close if ok.

Benito van der Zander

2009-06-20 18:45

reporter   ~0028645

The patch seems to be completely applied, but there is still a missing feature in comparison to the Delphi custom draw:
You can't change the font style in the customdraw event.

Perhaps this can be solved by checking for a changed font in the HandleListViewCustomDraw procedure and then add the CDRF_NEWFONT flag (and if it is sure that the new font is actually selected into the device context)

Zeljan Rikalo

2012-03-17 12:47

developer   ~0057762

We need OwnerDraw property as first step into fixing owner drawings in listviews and checklistbox. WS must know that it must pass items paint event to lcl.
Maybe OwnerDraw isn't needed by win32, but qt,carbon and gtk2 should not work without it.

Zeljan Rikalo

2013-10-06 19:24

developer   ~0070578

I've implemented qt part in r43135, win32 is missing OnDrawItem (OwnerDraw property), and gtk2 does not trigger OnCustomDraw (only OnCustomDrawItem and OnCustomDrawSubItem)...seem that we are missing one liner in gtk2 paint event of listview.

Zeljan Rikalo

2013-10-06 19:25

developer   ~0070579

I've changed a bit issue info and reverted target to 1.2

Andrey Zubarev

2013-10-06 20:02

reporter   ~0070582

related? http://bugs.freepascal.org/view.php?id=24941
Also I want to add that in GTK2 default draw still occur, despite the fact that DefaultDraw:=false in OnCustomDrawSubItem handler

Zeljan Rikalo

2013-10-07 14:26

developer   ~0070613

@Andrey, gtk2 is pretty tricky about it. pls. open separate issue about gtk2 and attach example.

Zeljan Rikalo

2013-10-07 15:43

developer   ~0070615

Please test and close if ok. In the meantime OwnerDraw property and OnDrawItem event is implemented for win32,gtk2 and qt.
Please do not reopen if CDRF_NEWFONT is missing. For that purpose open new issue and attach example. OnCustomXXX OnAdvancedXXX, OnDrawItem are implemented now and that's what this issue is talking about.

Issue History

Date Modified Username Field Change
2006-06-18 19:21 Benito van der Zander New Issue
2006-06-18 19:21 Benito van der Zander File Added: listview.patch
2006-06-18 19:22 Benito van der Zander Widgetset => Win32
2006-06-19 08:08 Vincent Snijders Note Added: 0008171
2006-06-21 17:12 Vincent Snijders Status new => assigned
2006-06-21 17:12 Vincent Snijders Assigned To => Mattias Gaertner
2006-06-22 20:34 Benito van der Zander File Added: winext.patch
2006-06-25 12:52 Benito van der Zander File Added: listview.patch_new
2006-06-25 13:17 Benito van der Zander Note Added: 0008220
2006-08-03 23:44 Benito van der Zander Note Added: 0008599
2006-08-24 01:01 Mattias Gaertner Target => -
2006-08-24 01:01 Mattias Gaertner Note Added: 0008748
2006-08-24 01:01 Mattias Gaertner Status assigned => feedback
2006-08-24 07:37 Vincent Snijders Status feedback => assigned
2006-08-24 07:37 Vincent Snijders Assigned To Mattias Gaertner => Marc Weustink
2006-08-24 07:37 Vincent Snijders Target - => 0.9.18
2006-08-30 01:46 Marc Weustink Note Added: 0008815
2006-08-30 01:48 Marc Weustink Note Edited: 0008815
2006-08-30 21:45 Vincent Snijders Note Added: 0008818
2006-08-31 17:24 Marc Weustink Note Added: 0008820
2006-08-31 21:45 Vincent Snijders Note Added: 0008825
2006-09-10 21:08 Benito van der Zander Note Added: 0008895
2006-09-10 21:08 Benito van der Zander File Added: listview.patch3
2006-09-24 11:23 Vincent Snijders Target 0.9.18 => 0.9.20
2006-09-24 11:23 Vincent Snijders Note Added: 0009063
2006-10-03 13:41 haword Note Added: 0009197
2006-11-25 13:20 Vincent Snijders LazTarget 0.9.20 => 0.9.22
2006-11-25 13:27 Vincent Snijders LazTarget 0.9.22 => post 1.0
2006-11-25 13:27 Vincent Snijders Note Added: 0009975
2006-11-25 13:27 Vincent Snijders Assigned To Marc Weustink =>
2006-11-25 13:27 Vincent Snijders Status assigned => acknowledged
2007-09-21 05:34 Paul Ishenin Relationship added related to 0009255
2008-09-10 14:16 Benito van der Zander Note Added: 0022111
2009-05-28 06:39 Vincent Snijders Relationship added parent of 0013847
2009-05-28 09:22 Vincent Snijders Fixed in Revision => 20273
2009-05-28 09:22 Vincent Snijders LazTarget post 1.0 => -
2009-05-28 09:22 Vincent Snijders Status acknowledged => resolved
2009-05-28 09:22 Vincent Snijders Fixed in Version => 0.9.27 (SVN)
2009-05-28 09:22 Vincent Snijders Resolution open => fixed
2009-05-28 09:22 Vincent Snijders Assigned To => Vincent Snijders
2009-05-28 09:22 Vincent Snijders Note Added: 0028094
2009-06-20 18:45 Benito van der Zander Note Added: 0028645
2009-06-20 18:45 Benito van der Zander Status resolved => assigned
2009-06-20 18:45 Benito van der Zander Resolution fixed => reopened
2009-06-20 19:18 Vincent Snijders LazTarget - => post 1.2
2009-06-20 19:18 Vincent Snijders Assigned To Vincent Snijders =>
2009-06-20 19:18 Vincent Snijders Status assigned => acknowledged
2012-02-10 09:18 Zeljan Rikalo Tag Attached: ListView
2012-03-17 12:46 Zeljan Rikalo Relationship added related to 0014071
2012-03-17 12:47 Zeljan Rikalo Note Added: 0057762
2013-09-03 12:07 Martin Friebe LazTarget post 1.2 => 1.4
2013-10-06 19:19 Zeljan Rikalo Assigned To => Zeljan Rikalo
2013-10-06 19:19 Zeljan Rikalo Status acknowledged => assigned
2013-10-06 19:24 Zeljan Rikalo Note Added: 0070578
2013-10-06 19:25 Zeljan Rikalo Fixed in Revision 20273 => 20273,43135
2013-10-06 19:25 Zeljan Rikalo LazTarget 1.4 => 1.2
2013-10-06 19:25 Zeljan Rikalo Widgetset Win32/Win64 => GTK 2, Win32/Win64, QT
2013-10-06 19:25 Zeljan Rikalo Note Added: 0070579
2013-10-06 20:02 Andrey Zubarev Note Added: 0070582
2013-10-06 20:02 Zeljan Rikalo Relationship added related to 0025149
2013-10-07 14:25 Zeljan Rikalo Relationship added related to 0024941
2013-10-07 14:26 Zeljan Rikalo Note Added: 0070613
2013-10-07 15:43 Zeljan Rikalo Fixed in Revision 20273,43135 => 20273,43135,43157
2013-10-07 15:43 Zeljan Rikalo Note Added: 0070615
2013-10-07 15:43 Zeljan Rikalo Status assigned => resolved
2013-10-07 15:43 Zeljan Rikalo Resolution reopened => fixed