@@ -10307,18 +10307,19 @@ function TVTHeader.HandleHeaderMouseMove(var Message: TLMMouseMove): Boolean;
10307
10307
HandleHeaderMouseMove := True;
10308
10308
Result := 0;
10309
10309
end
10310
- else if hsHeightTrackPending in FStates then
10311
- begin
10312
- FStates := FStates - [hsHeightTrackPending] + [hsHeightTracking];
10313
- HandleHeaderMouseMove := True;
10314
- Result := 0;
10315
- end
10316
10310
else
10317
- if hsColumnWidthTracking in FStates then
10311
+ if hsHeightTrackPending in FStates then
10318
10312
begin
10319
- if DoColumnWidthTracking(FColumns.FTrackIndex, GetShiftState, FTrackPoint, P) then
10313
+ FStates := FStates - [hsHeightTrackPending] + [hsHeightTracking];
10314
+ HandleHeaderMouseMove := True;
10315
+ Result := 0;
10316
+ end
10317
+ else
10318
+ if hsColumnWidthTracking in FStates then
10319
+ begin
10320
+ if DoColumnWidthTracking(FColumns.FTrackIndex, GetShiftState, FTrackPoint, P) then
10320
10321
begin
10321
- if Treeview.UseRightToLeftAlignment then
10322
+ if Treeview.UseRightToLeftAlignment then
10322
10323
begin
10323
10324
NewWidth := FTrackPoint.X - XPos;
10324
10325
NextColumn := FColumns.GetPreviousVisibleColumn(FColumns.FTrackIndex);
@@ -10337,56 +10338,57 @@ function TVTHeader.HandleHeaderMouseMove(var Message: TLMMouseMove): Boolean;
10337
10338
(FColumns[FColumns.FTrackIndex].FMaxWidth > NewWidth) then
10338
10339
FColumns[NextColumn].Width := FColumns[NextColumn].Width - NewWidth
10339
10340
+ FColumns[FColumns.FTrackIndex].Width
10340
- else
10341
- FColumns[FColumns.FTrackIndex].Width := NewWidth; // 1 EListError seen here (List index out of bounds (-1)) since 10/2013
10342
- HandleHeaderMouseMove := True;
10343
- Result := 0;
10344
- end
10345
- else if hsHeightTracking in FStates then
10346
- begin
10347
- //lclheader
10348
- //fixes setting height
10349
- Dec(P.Y, FHeight);
10350
- if DoHeightTracking(P, GetShiftState) then
10351
- SetHeight(Integer(FHeight) + P.Y);
10352
- HandleHeaderMouseMove := True;
10353
- Result := 0;
10354
- end
10355
- else
10356
- begin
10357
- if hsDragPending in FStates then
10358
- begin
10359
- P := Treeview.ClientToScreen(P);
10360
- // start actual dragging if allowed
10361
- if (hoDrag in FOptions) and Treeview.DoHeaderDragging(FColumns.FDownIndex) then
10362
- begin
10363
- if ((Abs(FDragStart.X - P.X) > DragManager.DragThreshold) or
10364
- (Abs(FDragStart.Y - P.Y) > DragManager.DragThreshold)) then
10365
- begin
10366
- {$ifdef DEBUG_VTV}Logger.Send([lcDrag], 'HandleHeaderMouseMove - DragIndex: %d - DownIndex: %d',
10367
- [FColumns.FDragIndex, FColumns.FDownIndex]);{$endif}
10368
- I := FColumns.FDownIndex;
10369
- FColumns.FDownIndex := NoColumn;
10370
- FColumns.FHoverIndex := NoColumn;
10371
- if I > NoColumn then
10372
- Invalidate(FColumns[I]);
10373
- //todo: implement drag image under gtk
10374
- PrepareDrag(P, FDragStart);
10375
- FStates := FStates - [hsDragPending] + [hsDragging];
10376
- HandleHeaderMouseMove := True;
10377
- Result := 0;
10378
- end;
10341
+ else
10342
+ FColumns[FColumns.FTrackIndex].Width := NewWidth; // 1 EListError seen here (List index out of bounds (-1)) since 10/2013
10379
10343
end;
10344
+ HandleHeaderMouseMove := True;
10345
+ Result := 0;
10380
10346
end
10381
10347
else
10382
- if hsDragging in FStates then
10348
+ if hsHeightTracking in FStates then
10383
10349
begin
10384
- DragTo(Treeview.ClientToScreen(P));
10350
+ //lclheader
10351
+ //fixes setting height
10352
+ Dec(P.Y, FHeight);
10353
+ if DoHeightTracking(P, GetShiftState) then
10354
+ SetHeight(Integer(FHeight) + P.Y);
10385
10355
HandleHeaderMouseMove := True;
10386
10356
Result := 0;
10357
+ end
10358
+ else
10359
+ begin
10360
+ if hsDragPending in FStates then
10361
+ begin
10362
+ P := Treeview.ClientToScreen(P);
10363
+ // start actual dragging if allowed
10364
+ if (hoDrag in FOptions) and Treeview.DoHeaderDragging(FColumns.FDownIndex) then
10365
+ begin
10366
+ if ((Abs(FDragStart.X - P.X) > DragManager.DragThreshold) or
10367
+ (Abs(FDragStart.Y - P.Y) > DragManager.DragThreshold)) then
10368
+ begin
10369
+ {$ifdef DEBUG_VTV}Logger.Send([lcDrag], 'HandleHeaderMouseMove - DragIndex: %d - DownIndex: %d',
10370
+ [FColumns.FDragIndex, FColumns.FDownIndex]);{$endif}
10371
+ I := FColumns.FDownIndex;
10372
+ FColumns.FDownIndex := NoColumn;
10373
+ FColumns.FHoverIndex := NoColumn;
10374
+ if I > NoColumn then
10375
+ Invalidate(FColumns[I]);
10376
+ //todo: implement drag image under gtk
10377
+ PrepareDrag(P, FDragStart);
10378
+ FStates := FStates - [hsDragPending] + [hsDragging];
10379
+ HandleHeaderMouseMove := True;
10380
+ Result := 0;
10381
+ end;
10382
+ end;
10383
+ end
10384
+ else
10385
+ if hsDragging in FStates then
10386
+ begin
10387
+ DragTo(Treeview.ClientToScreen(P));
10388
+ HandleHeaderMouseMove := True;
10389
+ Result := 0;
10390
+ end;
10387
10391
end;
10388
- end;
10389
- end;
10390
10392
end;
10391
10393
end;
10392
10394
@@ -10440,15 +10442,16 @@ function TVTHeader.HandleMessage(var Message: TLMessage): Boolean;
10440
10442
begin
10441
10443
if not (tsWindowCreating in FOwner.FStates) then
10442
10444
if (hoAutoResize in FOptions) and not (hsAutoSizing in FStates) then
10443
- begin
10444
- FColumns.AdjustAutoSize(InvalidColumn);
10445
- Invalidate(nil);
10446
- end
10447
- else if not (hsScaling in FStates) then
10448
10445
begin
10449
- RescaleHeader ;
10446
+ FColumns.AdjustAutoSize(InvalidColumn) ;
10450
10447
Invalidate(nil);
10451
- end;
10448
+ end
10449
+ else
10450
+ if not (hsScaling in FStates) then
10451
+ begin
10452
+ RescaleHeader;
10453
+ Invalidate(nil);
10454
+ end;
10452
10455
end;
10453
10456
CM_PARENTFONTCHANGED:
10454
10457
if FParentFont then
@@ -10497,31 +10500,33 @@ function TVTHeader.HandleMessage(var Message: TLMessage): Boolean;
10497
10500
SetHeight(FMinHeight);
10498
10501
Result := True;
10499
10502
end
10500
- else if HSplitterHit and (Message.Msg = LM_LBUTTONDBLCLK) and
10501
- (hoDblClickResize in FOptions) and (FColumns.FTrackIndex > NoColumn) then
10502
- begin
10503
- // If the click was on a splitter then resize column to smallest width.
10504
- if DoColumnWidthDblClickResize(FColumns.FTrackIndex, P, GetShiftState) then
10503
+ else
10504
+ if HSplitterHit and (Message.Msg = LM_LBUTTONDBLCLK) and
10505
+ (hoDblClickResize in FOptions) and (FColumns.FTrackIndex > NoColumn) then
10506
+ begin
10507
+ // If the click was on a splitter then resize column to smallest width.
10508
+ if DoColumnWidthDblClickResize(FColumns.FTrackIndex, P, GetShiftState) then
10505
10509
AutoFitColumns(True, smaUseColumnOption, FColumns[FColumns.FTrackIndex].FPosition,
10506
10510
FColumns[FColumns.FTrackIndex].FPosition);
10507
- Message.Result := 0;
10508
- Result := True;
10509
- end
10510
- else if IsInHeader and (Message.Msg <> LM_LBUTTONDBLCLK) then
10511
- begin
10512
- case Message.Msg of
10513
- LM_MBUTTONDBLCLK:
10514
- Button := mbMiddle;
10515
- LM_RBUTTONDBLCLK:
10516
- Button := mbRight;
10511
+ Message.Result := 0;
10512
+ Result := True;
10513
+ end
10517
10514
else
10518
- // WM_NCLBUTTONDBLCLK
10519
- Button := mbLeft;
10520
- end;
10521
- if Button = mbLeft then
10522
- Columns.AdjustDownColumn(P);
10523
- FColumns.HandleClick(P, Button, True, True);
10524
- end;
10515
+ if IsInHeader and (Message.Msg <> LM_LBUTTONDBLCLK) then
10516
+ begin
10517
+ case Message.Msg of
10518
+ LM_MBUTTONDBLCLK:
10519
+ Button := mbMiddle;
10520
+ LM_RBUTTONDBLCLK:
10521
+ Button := mbRight;
10522
+ else
10523
+ // WM_NCLBUTTONDBLCLK
10524
+ Button := mbLeft;
10525
+ end;
10526
+ if Button = mbLeft then
10527
+ Columns.AdjustDownColumn(P);
10528
+ FColumns.HandleClick(P, Button, True, True);
10529
+ end;
10525
10530
end;
10526
10531
// The "hot" area of the headers horizontal splitter is partly within the client area of the the tree, so we need
10527
10532
// to handle WM_LBUTTONDOWN here, too.
0 commit comments