USEGEAR

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

unigui显示uniTreeVview使用TUniTreeNode内存泄漏的问题【14】

uniTreeVviewc创建一个tree,显示患者姓名(PatientName)。因为需要用到患者ID(PatientID),所以使用help:

复制代码
  TPatientTreeNode = class(TUniTreeNode)
  //strict
  private
    FPatientID: string;
    function GetPatientID: string;
    procedure SetPatientID(const Value: string);
  public
    property PatientID: string read FPatientID write FPatientID;
  end;

在增加node时:
   node.Text := fdqry_patient.FieldByName('Name').AsString + fdqry_patient.FieldByName('Patient_ID').AsString;
   node.PatientID:= fdqry_patient.FieldByName('Patient_ID').AsString;
复制代码

看起来很美好。但是在过程中和关闭时,总是内存泄漏。对于node怎么释放都是泄漏。能力有限就是搞不定。

兄弟你怎么做的请告诉我。

最后没办法。使用字典绕过去。  

复制代码
    FTag : Integer;
    FPatients : TDictionary<string, string>;

        while not fdqry_patient.Eof do
          begin
            node :=untrvw_DeptPatient.Items.AddChild(parentNode, '');
            node.Text := fdqry_patient.FieldByName('Name').AsString + fdqry_patient.FieldByName('Patient_ID').AsString;
            node.Tag := FTag;// :=fdqry_patient.FieldByName('Patient_ID').AsString;

            FPatients.Add((IntToStr(FTag)), fdqry_patient.FieldByName('Patient_ID').AsString);
            Inc(FTag);
            fdqry_patient.Next;
            node := nil;
          end;
复制代码

posted on   USEGEAR  阅读(148)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
点击右上角即可分享
微信分享提示