mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Set focused node to the first selected one after a refresh action. Not doing this, the focused node somehow "jumps" randomly if the list was sorted. Plus: break early if the list doesn't have multiselection enabled.
This commit is contained in:
@ -2281,11 +2281,20 @@ procedure SetVTSelection( VT: TVirtualStringTree; Selected: TWideStringList );
|
||||
var
|
||||
Node: PVirtualNode;
|
||||
NodeData: PVTreeData;
|
||||
IsSel, FoundFocus: Boolean;
|
||||
begin
|
||||
Node := VT.GetFirst;
|
||||
FoundFocus := False;
|
||||
while Assigned(Node) do begin
|
||||
NodeData := VT.GetNodeData(Node);
|
||||
VT.Selected[Node] := Selected.IndexOf(NodeData.Captions[0]) > -1;
|
||||
IsSel := Selected.IndexOf(NodeData.Captions[0]) > -1;
|
||||
VT.Selected[Node] := IsSel;
|
||||
if IsSel and not FoundFocus then begin
|
||||
VT.FocusedNode := Node;
|
||||
FoundFocus := True;
|
||||
end;
|
||||
if IsSel and not (toMultiSelect in VT.TreeOptions.SelectionOptions) then
|
||||
break;
|
||||
Node := VT.GetNext(Node);
|
||||
end;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user