Skip to content

Commit bd7bf2b

Browse files
author
Joachim Marder
committed
2 parents 4199d5e + 03e097e commit bd7bf2b

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

Source/VirtualTrees.BaseTree.pas

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7545,7 +7545,7 @@ procedure TBaseVirtualTree.WMNCDestroy(var Message: TWMNCDestroy);
75457545
StopTimer(ChangeTimer);
75467546
StopTimer(StructureChangeTimer);
75477547

7548-
if not (csDesigning in ComponentState) and (toAcceptOLEDrop in FOptions.MiscOptions) and HandleAllocated then
7548+
if not (csDesigning in ComponentState) and HandleAllocated then
75497549
RevokeDragDrop(Handle);
75507550

75517551
inherited;
@@ -8729,9 +8729,8 @@ procedure TBaseVirtualTree.CreateWnd;
87298729
PrepareBitmaps(True, True);
87308730

87318731
// Register tree as OLE drop target.
8732-
if not (csDesigning in ComponentState) and (toAcceptOLEDrop in FOptions.MiscOptions) then
8733-
if not (csLoading in ComponentState) then // will be done in Loaded after all inherited settings are loaded from the DFMs
8734-
RegisterDragDrop(Handle, DragManager as IDropTarget);
8732+
if not (csDesigning in ComponentState) and not (csLoading in ComponentState) then // will be done in Loaded after all inherited settings are loaded from the DFMs
8733+
RegisterDragDrop(Handle, DragManager as IDropTarget);
87358734

87368735
UpdateScrollBars(True);
87378736
UpdateHeaderRect;
@@ -11222,6 +11221,12 @@ function TBaseVirtualTree.DragEnter(KeyState: Integer; Pt: TPoint; var Effect: I
1122211221

1122311222
begin
1122411223
try
11224+
if not (toAcceptOLEDrop in TreeOptions.MiscOptions) then
11225+
begin
11226+
Effect := DROPEFFECT_NONE;
11227+
Exit(NOERROR);
11228+
end;
11229+
1122511230
// Determine acceptance of drag operation and reset scroll start time.
1122611231
FDragScrollStart := 0;
1122711232

@@ -13484,9 +13489,8 @@ procedure TBaseVirtualTree.Loaded;
1348413489
inherited;
1348513490

1348613491
// Call RegisterDragDrop after all visual inheritance changes to MiscOptions have been applied.
13487-
if not (csDesigning in ComponentState) and (toAcceptOLEDrop in FOptions.MiscOptions) then
13488-
if HandleAllocated then
13489-
RegisterDragDrop(Handle, DragManager as IDropTarget);
13492+
if not (csDesigning in ComponentState) and HandleAllocated then
13493+
RegisterDragDrop(Handle, DragManager as IDropTarget);
1349013494

1349113495
// If a root node count has been set during load of the tree then update its child structure now
1349213496
// as this hasn't been done yet in this case.

Source/VirtualTrees.DragnDrop.pas

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ function TVTDragManager.DragEnter(const DataObject : IDataObject; KeyState : Int
259259
LockWindowUpdate(0);
260260
if Assigned(FDropTargetHelper) and FFullDragging then
261261
begin
262-
if toAutoScroll in TreeView.TreeOptions.AutoOptions then
262+
if (toAutoScroll in TreeView.TreeOptions.AutoOptions) and (toAcceptOLEDrop in TreeView.TreeOptions.MiscOptions) then
263263
FDropTargetHelper.DragEnter(FOwner.Handle, DataObject, Pt, Effect)
264264
else
265265
FDropTargetHelper.DragEnter(0, DataObject, Pt, Effect); // Do not pass handle, otherwise the IDropTargetHelper will perform autoscroll. Issue #486
@@ -286,7 +286,8 @@ function TVTDragManager.DragLeave : HResult;
286286
if Assigned(FDropTargetHelper) and FFullDragging then
287287
FDropTargetHelper.DragLeave;
288288

289-
TreeView.DragLeave;
289+
if (toAcceptOLEDrop in TreeView.TreeOptions.MiscOptions) then
290+
TreeView.DragLeave;
290291
FIsDropTarget := False;
291292
FDragSource := nil;
292293
FDataObject := nil;
@@ -301,12 +302,12 @@ function TVTDragManager.DragOver(KeyState : Integer; Pt : TPoint; var Effect : I
301302
if Assigned(FDropTargetHelper) and FFullDragging then
302303
FDropTargetHelper.DragOver(Pt, Effect);
303304

305+
Result := NOERROR;
304306
if Assigned(fHeader) then
305307
begin
306308
TreeView.Header.DragTo(Pt);
307-
Result := NOERROR;
308309
end
309-
else
310+
else if (toAcceptOLEDrop in TreeView.TreeOptions.MiscOptions) then
310311
Result := TreeView.DragOver(FDragSource, KeyState, dsDragMove, Pt, Effect);
311312
end;
312313

Source/VirtualTrees.Header.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,6 +2941,7 @@ function TVirtualTreeColumn.GetCaptionWidth : TDimension;
29412941

29422942
PaintInfo.Column := Self;
29432943
PaintInfo.TargetCanvas := Owner.HeaderBitmap.Canvas;
2944+
PaintInfo.TargetCanvas.Font := Header.Font;
29442945

29452946
with PaintInfo, Column do
29462947
begin

Source/VirtualTrees.Types.pas

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,12 +1363,8 @@ procedure TCustomVirtualTreeOptions.SetMiscOptions(const Value : TVTMiscOptions)
13631363

13641364
if not (csDesigning in ComponentState) then
13651365
begin
1366-
if toAcceptOLEDrop in ToBeCleared then
1367-
RevokeDragDrop(Handle);
13681366
if toFullRepaintOnResize in ToBeSet + ToBeCleared then
13691367
RecreateWnd;
1370-
if toAcceptOLEDrop in ToBeSet then
1371-
RegisterDragDrop(Handle, DragManager as IDropTarget);
13721368
if toVariableNodeHeight in ToBeSet then
13731369
begin
13741370
BeginUpdate();

0 commit comments

Comments
 (0)