mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 23:38:23 +02:00
LCL/ListView: Fix OnSelectItem not showing previously selected item when argument Selected=false (on Windows).
This commit is contained in:
parent
829bad776f
commit
9aa8b52ba2
@ -260,6 +260,7 @@ var
|
|||||||
nm: PNMListView;
|
nm: PNMListView;
|
||||||
Item: TListItem;
|
Item: TListItem;
|
||||||
n: Integer;
|
n: Integer;
|
||||||
|
oldSelected: TListItem;
|
||||||
begin
|
begin
|
||||||
nm := PNMListView(AMessage.NMHdr);
|
nm := PNMListView(AMessage.NMHdr);
|
||||||
// ignore any notifications while initializing items
|
// ignore any notifications while initializing items
|
||||||
@ -347,6 +348,7 @@ begin
|
|||||||
if (((nm^.uOldState and LVIS_SELECTED) <> (nm^.uNewState and LVIS_SELECTED)))
|
if (((nm^.uOldState and LVIS_SELECTED) <> (nm^.uNewState and LVIS_SELECTED)))
|
||||||
or (not (lffSelectedValid in FFlags) and (nm^.uNewState and LVIS_SELECTED <> 0)) then
|
or (not (lffSelectedValid in FFlags) and (nm^.uNewState and LVIS_SELECTED <> 0)) then
|
||||||
begin
|
begin
|
||||||
|
oldSelected := FSelected;
|
||||||
if MultiSelect and OwnerData then
|
if MultiSelect and OwnerData then
|
||||||
UpdateMultiSelList(Item, nm^.uNewState and LVIS_SELECTED <> 0);
|
UpdateMultiSelList(Item, nm^.uNewState and LVIS_SELECTED <> 0);
|
||||||
|
|
||||||
@ -358,9 +360,12 @@ begin
|
|||||||
if FSelected = Item then
|
if FSelected = Item then
|
||||||
InvalidateSelected
|
InvalidateSelected
|
||||||
end else
|
end else
|
||||||
|
begin
|
||||||
if (nm^.iItem < 0) or (nm^.iItem = FSelectedIdx) then
|
if (nm^.iItem < 0) or (nm^.iItem = FSelectedIdx) then
|
||||||
if not MultiSelect then
|
if not MultiSelect then
|
||||||
InvalidateSelected;
|
InvalidateSelected;
|
||||||
|
Item := oldSelected;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
FSelected := Item;
|
FSelected := Item;
|
||||||
|
Loading…
Reference in New Issue
Block a user