From ce3cb495c0d0a6eeb63cff940822a1c18582e0b5 Mon Sep 17 00:00:00 2001 From: blikblum Date: Sun, 22 Jun 2014 14:54:09 +0000 Subject: [PATCH] * Fix multiselect with toFullRowDrag. Issue 25894 git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3215 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../branches/4.8/VirtualTrees.pas | 11 ++++++++++- .../virtualtreeview-new/trunk/VirtualTrees.pas | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/components/virtualtreeview-new/branches/4.8/VirtualTrees.pas b/components/virtualtreeview-new/branches/4.8/VirtualTrees.pas index 644ac2d26..921270953 100644 --- a/components/virtualtreeview-new/branches/4.8/VirtualTrees.pas +++ b/components/virtualtreeview-new/branches/4.8/VirtualTrees.pas @@ -20945,7 +20945,16 @@ begin MultiSelect := toMultiSelect in FOptions.FSelectionOptions; ShiftEmpty := ShiftState = []; NodeSelected := IsAnyHit and (vsSelected in HitInfo.HitNode.States); - FullRowDrag := toFullRowDrag in FOptions.FMiscOptions; + if MultiSelect then + begin + // If MultiSelect is selected we will start a full row drag only in case a label was hit, + // otherwise a multi selection will start. + FullRowDrag := (toFullRowDrag in FOptions.FMiscOptions) and IsCellHit and + not (hiNowhere in HitInfo.HitPositions) and + (NodeSelected or (hiOnItemLabel in HitInfo.HitPositions) or (hiOnNormalIcon in HitInfo.HitPositions)) + end + else // No MultiSelect, hence we can start a drag anywhere in the row. + FullRowDrag := toFullRowDrag in FOptions.FMiscOptions; IsHeightTracking := (Message.Msg = LM_LBUTTONDOWN) and (toNodeHeightResize in FOptions.FMiscOptions) and (hiOnItem in HitInfo.HitPositions) and ([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []) and diff --git a/components/virtualtreeview-new/trunk/VirtualTrees.pas b/components/virtualtreeview-new/trunk/VirtualTrees.pas index af998904b..a33222aa7 100644 --- a/components/virtualtreeview-new/trunk/VirtualTrees.pas +++ b/components/virtualtreeview-new/trunk/VirtualTrees.pas @@ -21226,7 +21226,17 @@ begin MultiSelect := toMultiSelect in FOptions.FSelectionOptions; ShiftEmpty := ShiftState = []; NodeSelected := IsAnyHit and (vsSelected in HitInfo.HitNode.States); - FullRowDrag := toFullRowDrag in FOptions.FMiscOptions; + if MultiSelect then + begin + // If MultiSelect is selected we will start a full row drag only in case a label was hit, + // otherwise a multi selection will start. + FullRowDrag := (toFullRowDrag in FOptions.FMiscOptions) and IsCellHit and + not (hiNowhere in HitInfo.HitPositions) and + (NodeSelected or (hiOnItemLabel in HitInfo.HitPositions) or (hiOnNormalIcon in HitInfo.HitPositions)) + end + else // No MultiSelect, hence we can start a drag anywhere in the row. + FullRowDrag := toFullRowDrag in FOptions.FMiscOptions; + IsHeightTracking := (Message.Msg = LM_LBUTTONDOWN) and (hiOnItem in HitInfo.HitPositions) and ([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []);