mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Enhancement for all VirtualTrees: Remember previously selected nodes and restore them after any refresh. Using existing helpers:GetVTCaptions plus new helpers:SetVTSelection
This commit is contained in:
@ -84,6 +84,7 @@ type
|
||||
function FormatTimeNumber( Seconds: Cardinal ): String;
|
||||
function TColorToHex( Color : TColor ): string;
|
||||
function GetVTCaptions( VT: TVirtualStringTree; OnlySelected: Boolean = False; Column: Integer = 0 ): TStringList;
|
||||
procedure SetVTSelection( VT: TVirtualStringTree; Selected: TStringList );
|
||||
function Pos2(const Needle, HayStack: string; const StartPos: Integer) : Integer;
|
||||
function GetTempDir: String;
|
||||
|
||||
@ -2125,6 +2126,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
The opposite of GetVTCaptions in "OnlySelected"-Mode:
|
||||
Set selected nodes in a VirtualTree
|
||||
}
|
||||
procedure SetVTSelection( VT: TVirtualStringTree; Selected: TStringList );
|
||||
var
|
||||
Node: PVirtualNode;
|
||||
NodeData: PVTreeData;
|
||||
begin
|
||||
Node := VT.GetFirst;
|
||||
while Assigned(Node) do begin
|
||||
NodeData := VT.GetNodeData(Node);
|
||||
if Selected.IndexOf(NodeData.Captions[0]) > -1 then begin
|
||||
if not Assigned(VT.FocusedNode) then
|
||||
VT.FocusedNode := Node;
|
||||
VT.Selected[Node] := True;
|
||||
end;
|
||||
Node := VT.GetNext(Node);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function Pos2(const Needle, HayStack: string; const StartPos: Integer) : Integer;
|
||||
var
|
||||
NewHayStack: string;
|
||||
|
Reference in New Issue
Block a user