View Issue Details

IDProjectCategoryView StatusLast Update
0035362LazarusLCLpublic2019-08-11 21:16
ReporterBrettAssigned ToMichl 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformWindowsOSOS Version
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0035362: ListView with MultiSelect incorrectly deselects items on MouseDown
DescriptionWhen using a ListView with MultiSelect=true, clicking the mouse button down on the selected list items to start a drag operation deselects all but the item being clicked on.

I believe this is caused by the fix for https://bugs.freepascal.org/view.php?id=33330, where ListViewProc() in win32wscustomlistview.inc is creating an LM_LBUTTONUP message. The problem is that this causes the list items to be deselected on MouseDown when you try to drag them, rather than on MouseUp.

I've attached a sample project to demonstrate, but it's not really necessary.
Steps To Reproduce1) Create TListView with some items and MultiSelect=true
2) Select some items with shift+click or ctrl+click
3) Mouse down on the selection to initiate a drag-drop operation
4) Watch all items except the current one get deselected
Additional InformationProblem is new in Lazarus 2.0, does not occur in 1.8.4.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetGTK 2, Win32/Win64
Attached Files

Relationships

related to 0033330 closedMichl Packages Mouse events do not fire properly when MultiSelect = True on TListView of win32/64 
related to 0033811 assignedMichl Lazarus Listview: DragMode dmAutomatic does not function with Multiselect enabled 
related to 0035917 new Lazarus MSWindows: TListView.OnContextPopup is called twice 

Activities

Brett

2019-04-11 07:24

reporter  

ListViewBug.zip (3,753 bytes)

Brett

2019-04-11 07:34

reporter   ~0115417

Apologies, this should have gone under Packages rather than FPC.

Cyrax

2019-04-11 07:53

reporter   ~0115418

Does this bug occur in the trunk or the fixes version?

Brett

2019-04-11 09:46

reporter   ~0115420

Yes, occurs in both Trunk and Fixes.

Juha Manninen

2019-04-12 13:09

developer   ~0115439

Last edited: 2019-04-12 13:11

View 2 revisions

TListView with GTK2 bindings has the same problem. It always had it, or at least since 2015.
QT works.

If this is a regression on Windows, I guess it should be fixed before the next dot release.
Brett, please make sure the bug is caused by r57906 from the related issue. Then we can reopen it.

Zeljan Rikalo

2019-04-12 14:14

developer   ~0115442

In that case both Windows and gtk2 must be fixed.

Brett

2019-04-12 14:27

reporter   ~0115443

Actually, the bug appears to only be present from r58092 (on Windows).

Serge Anvarov

2019-08-11 19:16

reporter   ~0117644

In 0033330 issue last change by Michl.
In win32wscustomlistview.inc in procedure ListViewProc code is:
[code]
...
        // for multiselected listbox the message has to be send after current
        // message or the list item selecting does not work, also see issue 0033330
        if not Assigned(ListItem) and ListView.MultiSelect then
        begin
          Result := WindowProc(Window, Msg, WParam, LParam);
          if not (Msg = WM_LBUTTONDBLCLK) and ((Msg = WM_LBUTTONDOWN) or not Assigned(ListView.PopupMenu)) then
            PostMessage(Window, AMsg, 0, MakeLParam(WindowInfo^.MouseX, WindowInfo^.MouseY));
          Exit;
        end;
...
[/code]
I don't understand the purpose of the piece "not Assigned(ListItem)". If remove it, the bug is not reproduced.

Issue History

Date Modified Username Field Change
2019-04-11 07:24 Brett New Issue
2019-04-11 07:24 Brett File Added: ListViewBug.zip
2019-04-11 07:34 Brett Note Added: 0115417
2019-04-11 07:53 Cyrax Note Added: 0115418
2019-04-11 08:50 Jonas Maebe Project FPC => Lazarus
2019-04-11 09:46 Brett Note Added: 0115420
2019-04-12 10:10 Juha Manninen Relationship added related to 0033330
2019-04-12 13:09 Juha Manninen Note Added: 0115439
2019-04-12 13:11 Juha Manninen Note Edited: 0115439 View Revisions
2019-04-12 14:14 Zeljan Rikalo Note Added: 0115442
2019-04-12 14:27 Brett Note Added: 0115443
2019-04-12 14:54 Juha Manninen LazTarget => -
2019-04-12 14:54 Juha Manninen Widgetset => GTK 2, Win32/Win64
2019-04-12 14:54 Juha Manninen Product Version 3.0.4 =>
2019-04-12 14:56 Juha Manninen Relationship added related to 0033811
2019-08-11 11:41 Juha Manninen Relationship added related to 0035917
2019-08-11 19:16 Serge Anvarov Note Added: 0117644
2019-08-11 21:16 Juha Manninen Assigned To => Michl
2019-08-11 21:16 Juha Manninen Status new => assigned