Debugger, VTV: fix pop-up menu versus dragging. Only drag on left mouse -- Fix clearing controls that are invisible after scrolled by an expanding node.

This commit is contained in:
Martin 2022-06-14 22:34:13 +02:00
parent d1ca85c248
commit 3c5a7c2742

View File

@ -20,7 +20,7 @@ type
TDbgTreeView = class(TLazVirtualStringTree) TDbgTreeView = class(TLazVirtualStringTree)
private private
FLastVisibleBeforeExpanding: PVirtualNode; FFirstVisibleBeforeExpanding, FLastVisibleBeforeExpanding: PVirtualNode;
function GetNodeControl(Node: PVirtualNode): TControl; function GetNodeControl(Node: PVirtualNode): TControl;
function GetNodeItem(Node: PVirtualNode): TObject; function GetNodeItem(Node: PVirtualNode): TObject;
function GetNodeText(Node: PVirtualNode; AColumn: integer): String; function GetNodeText(Node: PVirtualNode; AColumn: integer): String;
@ -37,6 +37,7 @@ type
var LineImage: TLineImage): Integer; override; var LineImage: TLineImage): Integer; override;
function DetermineDropMode(const P: TPoint; var HitInfo: THitInfo; function DetermineDropMode(const P: TPoint; var HitInfo: THitInfo;
var NodeRect: TRect): TDropMode; override; var NodeRect: TRect): TDropMode; override;
procedure HandleMouseDown(var Message: TLMMouse; var HitInfo: THitInfo); override;
procedure HandleMouseDblClick(var Message: TLMMouse; const HitInfo: THitInfo); override; procedure HandleMouseDblClick(var Message: TLMMouse; const HitInfo: THitInfo); override;
procedure DoGetText(Node: PVirtualNode; Column: TColumnIndex; procedure DoGetText(Node: PVirtualNode; Column: TColumnIndex;
TextType: TVSTTextType; var AText: String); override; TextType: TVSTTextType; var AText: String); override;
@ -161,6 +162,7 @@ end;
function TDbgTreeView.DoExpanding(Node: PVirtualNode): Boolean; function TDbgTreeView.DoExpanding(Node: PVirtualNode): Boolean;
begin begin
FFirstVisibleBeforeExpanding := GetFirstVisibleNoInit(Node);
FLastVisibleBeforeExpanding := GetLastVisibleNoInit(Node); FLastVisibleBeforeExpanding := GetLastVisibleNoInit(Node);
Result := inherited DoExpanding(Node); Result := inherited DoExpanding(Node);
end; end;
@ -170,7 +172,9 @@ var
N: PVirtualNode; N: PVirtualNode;
NData: PDbgTreeNodeData; NData: PDbgTreeNodeData;
begin begin
N := GetLastVisibleNoInit(Node); N := FFirstVisibleBeforeExpanding;
if N = nil then
N := GetFirstNoInit;
while (N <> nil) do begin while (N <> nil) do begin
NData := GetNodeData(N); NData := GetNodeData(N);
if NData^.Control <> nil then if NData^.Control <> nil then
@ -225,6 +229,16 @@ begin
Result := dmNowhere; Result := dmNowhere;
end; end;
procedure TDbgTreeView.HandleMouseDown(var Message: TLMMouse;
var HitInfo: THitInfo);
begin
if Message.Msg = LM_LBUTTONDOWN then
DragMode := dmAutomatic
else
DragMode := dmManual;
inherited HandleMouseDown(Message, HitInfo);
end;
procedure TDbgTreeView.HandleMouseDblClick(var Message: TLMMouse; procedure TDbgTreeView.HandleMouseDblClick(var Message: TLMMouse;
const HitInfo: THitInfo); const HitInfo: THitInfo);
begin begin