[英]Highlight focused node
在 VirtualTreeView 中使用 getprevious(node) 或 getnext(node) 时,是否可以通过单击在选择节点上的上一个或下一个节点上获得蓝色突出显示?
This is how you make a node highlighted with blue: (or other colour set at VST.Colors...)这就是您如何使节点以蓝色突出显示:(或在 VST.Colors 中设置的其他颜色...)
VST.Selected[Node] := True;
Do not mix with : VST.FocusedNode
!不要与: VST.FocusedNode
!
You may consider to deselect the previous blue one first.您可以考虑先取消选择之前的蓝色。 If VST.TreeOptions.SelectionOptions >> toMultiSelect = False
, it's enough to simply "remember" the last one:如果VST.TreeOptions.SelectionOptions >> toMultiSelect = False
,只需“记住”最后一个就足够了:
var
LastSelected: PVirtualNode; // you can put this to the Form's private section
...
procedure DeselectLastOne();
begin
if (csDestroying in VST.ComponentState) then Exit;
if Assigned(LastSelected) then begin
VST.Selected[LastSelected] := False;
LastSelected := nil;
end;
end;
procedure SelectNewOne(N: PVirtualNode);
begin
if (csDestroying in VST.ComponentState) then Exit;
DeselectLastOne();
VST.Selected[N] := True;
LastSelected := N;
end;
initialization
LastSelected = nil; // you can put this to the Form's OnCreate proc.
But if you have set VST.TreeOptions.SelectionOptions >> toMultiSelect = True
than you'll have to iterate through VST.SelectedNodes()
function first to deselect ALL highlighted nodes.但是,如果您已设置VST.TreeOptions.SelectionOptions >> toMultiSelect = True
,则您必须首先遍历VST.SelectedNodes()
函数以取消选择所有突出显示的节点。
See also: VST.SelectedCount : integer;
另见: VST.SelectedCount : integer;
, VST.GetFirstSelected()
, VST.GetNextSelected()
, VST.GetFirstSelected()
, VST.GetNextSelected()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.