zoukankan
html css js c++ java
在Delphi中的TreeView中保存多个数据
使用Delphi几年后,居然不知道还可以这么用,惭愧呀
type
PMyRec
=
^
TMyRec;
TMyRec
=
record
FName:
string
;
LName:
string
;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MyRecPtr: PMyRec;
TreeViewIndex: LongInt;
begin
New(MyRecPtr);
MyRecPtr
^
.FName :
=
Edit1.Text;
MyRecPtr
^
.LName :
=
Edit2.Text;
TreeViewIndex :
=
StrToInt(Edit3.Text);
with TreeView1
do
begin
if
Items.Count
=
0
then
Items.AddObject(nil,
'
Item
'
+
IntToStr(TreeViewIndex), MyRecPtr)
else
if
(TreeViewIndex
<
Items.Count) and (TreeViewIndex
>=
0
) then
Items.AddObject(Items[TreeViewIndex],
'
Item
'
+
IntToStr(TreeViewIndex), MyRecPtr);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label1.Caption :
=
PMyRec(TreeView1.Selected.Data)
^
.FName
+
'
'
+
PMyRec(TreeView1.Selected.Data)
^
.LName;
end;
查看全文
相关阅读:
堆排序
2019晋城一中开放日
严格次小生成树
遥远的国度
noip2018游记
Luogu1736 创意吃鱼法
P3958 奶酪
Luogu3385 负环
Luogu1040 加分二叉树
Luogu1007 独木桥
原文地址:https://www.cnblogs.com/wjhx/p/459299.html
最新文章
周学习笔记(06)——大三下
cf877D
cf912D
cf936B
cf949C
cf938D
cf959E
cf960F
cf999E (强联通分量模板题)
cf1012B
热门文章
cf1037E
SPFA+SLF+LLL
Bellman-Ford算法
floyd算法
队列优化的dijkstra
快读
并查集
Kruskal算法
Prim算法
STL优先队列
Copyright © 2011-2022 走看看