View Issue Details

IDProjectCategoryView StatusLast Update
0025092LazarusPatchpublic2013-10-14 17:16
Reporterocean Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.1 (SVN) 
Summary0025092: Add ListView AddItem method
Descriptiontest: listview1.AddItem('test', nil);
TagsNo tags attached.
Fixed in Revision43245
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

ocean

2013-09-26 18:43

reporter  

lvadditem.patch (963 bytes)   
Index: lcl/comctrls.pp
===================================================================
--- lcl/comctrls.pp	(revision 42870)
+++ lcl/comctrls.pp	(working copy)
@@ -1506,6 +1506,7 @@
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
+    procedure AddItem(Item: string; AObject: TObject);
     function AlphaSort: Boolean; // always sorts column 0 in sdAscending order
     procedure BeginUpdate;
     procedure Clear;
Index: lcl/include/customlistview.inc
===================================================================
--- lcl/include/customlistview.inc	(revision 42870)
+++ lcl/include/customlistview.inc	(working copy)
@@ -943,6 +943,12 @@
   FreeAndNil(FIconOptions);
 end;
 
+procedure TCustomListView.AddItem(Item: string; AObject: TObject);
+begin
+  Items.Add.Caption := Item;
+  Items.Add.Data := AObject;
+end;
+
 function TCustomListView.AlphaSort: Boolean;
 begin
   Result := False;
lvadditem.patch (963 bytes)   

ocean

2013-09-26 18:59

reporter  

lvAddItem_try2.patch (1,004 bytes)   
Index: lcl/comctrls.pp
===================================================================
--- lcl/comctrls.pp	(revision 42947)
+++ lcl/comctrls.pp	(working copy)
@@ -1506,6 +1506,7 @@
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
+    procedure AddItem(Item: string; AObject: TObject);
     function AlphaSort: Boolean; // always sorts column 0 in sdAscending order
     procedure BeginUpdate;
     procedure Clear;
Index: lcl/include/customlistview.inc
===================================================================
--- lcl/include/customlistview.inc	(revision 42947)
+++ lcl/include/customlistview.inc	(working copy)
@@ -943,6 +943,15 @@
   FreeAndNil(FIconOptions);
 end;
 
+procedure TCustomListView.AddItem(Item: string; AObject: TObject);
+var
+  AItem: TListItem;
+begin
+  AItem := Items.Add;
+  AItem.Caption := Item;
+  AItem.Data := AObject;
+end;
+
 function TCustomListView.AlphaSort: Boolean;
 begin
   Result := False;
lvAddItem_try2.patch (1,004 bytes)   

ocean

2013-09-26 19:01

reporter   ~0070357

Sent too quickly, attached correct version.

ocean

2013-10-11 15:23

reporter   ~0070742

Is there something I missed, try2, looks simple

Bart Broersma

2013-10-11 16:25

developer   ~0070743

Why do we need this?

ocean

2013-10-11 16:45

reporter   ~0070745

>Why do we need this?

Method is in Delphi

Zeljan Rikalo

2013-10-11 18:17

developer   ~0070747

I'll add it when I finish some other changes in TCustomListView.

Zeljan Rikalo

2013-10-14 09:40

developer   ~0070811

Please test and close if ok. Will be merged to 1.0.99 (1.2 fixes)

Issue History

Date Modified Username Field Change
2013-09-26 18:43 ocean New Issue
2013-09-26 18:43 ocean File Added: lvadditem.patch
2013-09-26 18:59 ocean File Added: lvAddItem_try2.patch
2013-09-26 19:01 ocean Note Added: 0070357
2013-10-11 15:23 ocean Note Added: 0070742
2013-10-11 16:25 Bart Broersma Note Added: 0070743
2013-10-11 16:45 ocean Note Added: 0070745
2013-10-11 18:16 Zeljan Rikalo Assigned To => Zeljan Rikalo
2013-10-11 18:16 Zeljan Rikalo Status new => assigned
2013-10-11 18:17 Zeljan Rikalo Note Added: 0070747
2013-10-14 09:40 Zeljan Rikalo Fixed in Revision => 43245
2013-10-14 09:40 Zeljan Rikalo LazTarget => -
2013-10-14 09:40 Zeljan Rikalo Note Added: 0070811
2013-10-14 09:40 Zeljan Rikalo Status assigned => resolved
2013-10-14 09:40 Zeljan Rikalo Resolution open => fixed
2013-10-14 17:16 ocean Status resolved => closed