View Issue Details

IDProjectCategoryView StatusLast Update
0033870LazarusLCLpublic2018-06-21 18:23
ReporterFTurtle Assigned ToOndrej Pokorny  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSWindows XP 
Product Version1.9 (SVN) 
Summary0033870: TListView: Items.Exchange bug
DescriptionIf one of items has ImageIndex=-1 then after exchanging both items show same picture although both ImageIndex have right values.
See attached project.
Steps To ReproduceWay 1:
1. Run attached project (picture1.png)
2. Click button "2-3" (picture2.png)
3. See images and ImageIndex values at form caption.

Way 2:
1. Open "Toolbar Configuration" form.
2. Select divider at right list
3. Try move divider up and down.
TagsNo tags attached.
Fixed in Revision58325
LazTarget-
Widgetset
Attached Files

Activities

FTurtle

2018-06-17 08:10

reporter  

FTurtle

2018-06-17 08:10

reporter  

picture1.png (19,128 bytes)   
picture1.png (19,128 bytes)   

FTurtle

2018-06-17 08:11

reporter  

picture2.png (19,569 bytes)   
picture2.png (19,569 bytes)   

Serge Anvarov

2018-06-17 09:23

reporter   ~0108937

Add patch. Test it

Serge Anvarov

2018-06-17 09:23

reporter  

win32wscustomlistview.diff (568 bytes)   
Index: lcl/interfaces/win32/win32wscustomlistview.inc
===================================================================
--- lcl/interfaces/win32/win32wscustomlistview.inc	(revision 58294)
+++ lcl/interfaces/win32/win32wscustomlistview.inc	(working copy)
@@ -543,6 +543,8 @@
 
   LVItemAssign(ALV, AItem1, AIndex2);
   LVItemAssign(ALV, AItem2, AIndex1);
+  ItemSetImage(ALV, AIndex1, AItem2, 0, AItem2.ImageIndex);
+  ItemSetImage(ALV, AIndex2, AItem1, 0, AItem1.ImageIndex);
 end;
 
 class procedure TWin32WSCustomListView.ItemMove(const ALV: TCustomListView;
win32wscustomlistview.diff (568 bytes)   

FTurtle

2018-06-17 10:32

reporter   ~0108938

Yes, this patch solved the problem.

Juha Manninen

2018-06-19 00:02

developer   ~0108959

Applied, thanks.

FTurtle

2018-06-19 05:38

reporter   ~0108961

Thanks.

Ondrej Pokorny

2018-06-19 12:02

developer   ~0108965

Last edited: 2018-06-19 12:04

View 3 revisions

The patch solved this one issue but obviously if you studied the code you would find that the real bug is in LVItemAssign. LVItemAssign already does ItemSetImage but only if ImageIndex >= 0.

Your patch does not solve similar issues:
1.) wrong ItemIndex when Move() is used.
2.) wrong subitems texts when Exchange() and Move() is used.
3.) wrong StateIndex image when Exchange() and Move() is used.

I reverted the patch because it was only a dirty workaround and not a real solution.

Ondrej Pokorny

2018-06-19 12:14

developer   ~0108966

Fixed properly.

CudaText man

2018-06-19 12:56

reporter   ~0108967

Good new fix, and fix for ImageIndexes.

FTurtle

2018-06-21 18:23

reporter   ~0108994

Thanks.

Issue History

Date Modified Username Field Change
2018-06-17 08:10 FTurtle New Issue
2018-06-17 08:10 FTurtle File Added: LISTVIEW_BUG_DEMO_PRJ.zip
2018-06-17 08:10 FTurtle File Added: picture1.png
2018-06-17 08:11 FTurtle File Added: picture2.png
2018-06-17 09:23 Serge Anvarov Note Added: 0108937
2018-06-17 09:23 Serge Anvarov File Added: win32wscustomlistview.diff
2018-06-17 10:32 FTurtle Note Added: 0108938
2018-06-19 00:02 Juha Manninen Assigned To => Juha Manninen
2018-06-19 00:02 Juha Manninen Status new => assigned
2018-06-19 00:02 Juha Manninen Fixed in Revision => r58316
2018-06-19 00:02 Juha Manninen LazTarget => -
2018-06-19 00:02 Juha Manninen Note Added: 0108959
2018-06-19 00:02 Juha Manninen Status assigned => resolved
2018-06-19 00:02 Juha Manninen Resolution open => fixed
2018-06-19 05:38 FTurtle Note Added: 0108961
2018-06-19 05:38 FTurtle Status resolved => closed
2018-06-19 11:57 Ondrej Pokorny Assigned To Juha Manninen => Ondrej Pokorny
2018-06-19 11:57 Ondrej Pokorny Status closed => assigned
2018-06-19 11:57 Ondrej Pokorny Resolution fixed => reopened
2018-06-19 12:02 Ondrej Pokorny Note Added: 0108965
2018-06-19 12:03 Ondrej Pokorny Note Edited: 0108965 View Revisions
2018-06-19 12:04 Ondrej Pokorny Note Edited: 0108965 View Revisions
2018-06-19 12:14 Ondrej Pokorny Fixed in Revision r58316 => 58325
2018-06-19 12:14 Ondrej Pokorny Note Added: 0108966
2018-06-19 12:14 Ondrej Pokorny Status assigned => resolved
2018-06-19 12:14 Ondrej Pokorny Resolution reopened => fixed
2018-06-19 12:56 CudaText man Note Added: 0108967
2018-06-21 18:23 FTurtle Note Added: 0108994
2018-06-21 18:23 FTurtle Status resolved => closed