//操作: procedure TForm1.act_GetListExecute(Sender: TObject); begin FieldList := TStringList.create; TreeView1.items.BeginUpdate; Table1.Close; // 关键!这样才能在插入、更新、删除表数据后实现实时更新 Table1.Open; // 关键! Table1.first; while not Table1.eof do begin TreeAddItem(TreeView1, GetFieldList, Table1.getBookmark, false); Table1.next; end; FieldList.clear; TreeView1.Alphasort; TreeView1.items.Endupdate; TreeView1.Refresh; TreeView1.FullExpand; // 全部展开 end; //GetFieldList函数: function TForm1.GetFieldList: TStringList; begin FieldList.clear; FieldList.add(Table1.fieldbyname('Level1').AsString); FieldList.add(Table1.fieldbyname('Level2').AsString); FieldList.add(Table1.fieldbyname('Level3').Asstring); Result := FieldList; end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论