我正在编辑 TVirtualStringTree 中显示节点的第二列。但是,编辑完成后,我无法使用 Sender.GetNodeData(Node) 检索文本 - 它不包含任何文本。
如何获取 OnEdited 事件中的文本?还有其他方法可以获取编辑后的文本吗?我已经阅读了 Virtual Treeview CHM 帮助文档的前几个常见问题页面,并且还参考了这个 SO question中的答案,但找不到答案。
这是当前代码:
TTherapData = record
TherapID: Integer;
TherapName: String[120];
TherapInstr: String[120];
Selected: Byte;
end;
PTherapData = ^TTherapData;
procedure TfmPatient_Conslt.vstRxList_AsgEdited(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex);
var
TherapData: PTherapData;
begin
TherapData := Sender.GetNodeData(Node);
if Assigned(TherapData) then
begin
TherapData^.TherapInstr := vstRxList_Asg.Text[Node, 1];
showmessage(TherapData^.TherapInstr);
end;
FTherapDataListAsg_Iter := 0;
vstRxList_Asg.NodeDataSize := SizeOf(TTherapData);
vstRxList_Asg.RootNodeCount := 0;
vstRxList_Asg.RootNodeCount := TherapDataList_CountSelectedItems;
end;