在Treeview中节点的data属性中保存记录类型及其消除的办法
一、保存记录类型在data指针中:
type
Trec=record
text:string;
left,top,width,height:Integer;
end;
TPRec = ^TRec;
var
h,lh,w,tp,lt,m,firstp:Integer;
ht:THeadTreeNode;
currentnode,pnode:TTreeNode;
hh,ss,firsttext:string;
ntrec:TPrec;
begin
firsttext:=hnode.Text;
ht:=hnode;
m:=0;
while True do
begin
w:=ht.Width;
New(ntrec);
if w>0 then
begin
hh:=ht.Text;
lh:=ht.GetLevel;
h:=ht.Height;
if lh=1 then
i:=0;
//ss:='left:'+inttostr(j)+',top:'+inttostr(i)+',h:'+inttostr(h)+',w:'+inttostr(w)+',text:'+hh+',level:'+inttostr(lh);
//Memo1.Lines.Add(ss);
//build tree
if lh=1 then
currentnode:=tree.Items.Add(nil,hh)
else
begin
pnode:=findtreeitem(tree,ht.Host.Text);
currentnode:=tree.Items.AddChild(pnode,hh);
end;
ntrec^.text:=hh;
ntrec^.Top:=i;
ntrec^.Left:=j;
ntrec^.Width:=w;
ntrec^.Height:=h;
currentnode.Data:=ntrec;//CreateMemoFun(pp,hh,'leftcolumns',baNone,nil,'',j, i, w, h);
//ntrec:=TPRec(currentnode.Data);
with ntrec^ do
begin
ss:='nodename:'+hh+',left:'+inttostr(left)+',top:'+inttostr(top)+',width:'+inttostr(width)+',height:'+inttostr(Height)+',level:'+inttostr(lh);
end;
Memo1.Lines.Add(ss);
if m=0 then
firstp:=i
else
i:=firstp;
end else //跳过不可见列
w:=0;
if Assigned(ht.Child) then
begin
//tmph:=i;
i:=i+h;
getheaditems(pp,ht.Child,i,j,zh,tmph,tree);
end else
begin
j:=j+w;
zh:=i+h;
//i:=tmph;
end;
ht:=ht.Next;
m:=m+1;
if ht.Text=firsttext then
begin
Break;
end;
end;
end;
type
Trec=record
text:string;
left,top,width,height:Integer;
end;
TPRec = ^TRec;
var
tnode,fn:THeadTreeNode;
level,ss:string;
i:Integer;
begin
with TreeView1 do
begin
for I := 0 to Items.Count-1 do
begin
level:=IntToStr(items[i].Level);
if assigned(TPRec(items[i].Data)) then
begin
dispose(TPRec(items[i].Data));
Memo1.Lines.Add('已释放指针:'+items[i].Text);
end;
ss:='nodename:'+items[i].Text+',level:'+level+',sn:'+inttostr(i);
Memo1.Lines.Add(ss);
end;
end;
end;
在Treeview中节点的data属性中保存记录类型及其消除的办法的更多相关文章
- 006——VUE中的内容与属性中使用javascript表达式的方法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js中的访问器属性中的getter和setter函数实现数据双向绑定
嗯,之前在读js红宝书的时候,在对象那一章有介绍属性类型.第一种数据类型指的是数据属性,第二种是访问器属性.在初识vue的时候,其双向数据绑定也是基于访问器属性中的getter和setter函数原理来 ...
- IE8中li添加float属性,中英数字混合BUG
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 视图中 jquery 使用data属性
示例:<input id='username' data-id="{$val['id']}" data-userName="{$val['name']}" ...
- jsp <form>表单提交中如何在value属性中写表达式
<input type="text" name="grop_id" value="<%=rs.getString(2)%>" ...
- 多.h项目出现的问题:使用了预编译头依然出现error LNK2005:***obj已在***obj中定义与c++ error C2011: “xxx”:“class”类型重定义解决办法
使用了预编译头依然出现error LNK2005:***obj已在***obj中定义 造成该问题的可能性比较多,本人将在今后遇到时添加进来,今天先放出本人遇到的一种情况. 多重包含含有变量定义的.h文 ...
- PyQt(Python+Qt)入门:Designer组件属性编辑界面中QWidget类相关属性详解
本文适用人员:本文比较长,适合不理解Qt Designer部件属性的人员阅读或资料查找. 声明: 1.如果有人认为本文是简单的复制粘贴+翻译而成,敬请读本文最后的后记: 2.本文为老猿Python学习 ...
- HTML 5:你必须知道的data属性
原文:All You Need to Know About the HTML5 Data Attribute 译文:你必须知道HTML 5 的Data属性 译者:dwqs HTML 5的Data属性可 ...
- html 5实用特性之data属性
HTML 5之前,我们必须依赖于class和rel属性来存储需要在网站中使用的数据片段,这种做法有时会在网站的外观和实用性之间产生冲突.而HTML 5 Data属性的存在就能很好满足需要. HTML5 ...
随机推荐
- IAR模板--怎样在IARproject中创建和使用模板
怎样在IARproject中创建和使用模板 1.编辑和使用模板的方式: 路径为:Edit -> Code Templates -> Edit Templates 例如以下图: water ...
- zmqSocket 使用和相关java后台准备
zmqSocket.as 源码地址: http://zmqsocket-as.googlecode.com/svn/ zmqSocket.js 源码地址: http://zmqsocket-js.go ...
- 在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数P。并将P对1000000007取模的结果输出。 即输出P%1000000007
include "stdafx.h" #include<iostream> #include<vector> #include <algorithm& ...
- java高级之信号灯Semaphore
1.Semaphore概念 Semaphore是Java1.5之后提供的一种同步工具,Semaphore可以维护访问自身线程个数,并提供了同步机制.使用Semaphore可以控制同时访问资源的线程个数 ...
- selenium驱动Firefox跳转页慢慢慢的问题(待验证)
转载至http://www.cnblogs.com/yicaifeitian/p/5198871.html 为了解决这个问题,我是查了很多资料,解决方案是百度出来的.抱歉,我忘记出处在哪了,代码如下: ...
- BlockingQueue的使用 http://www.cnblogs.com/liuling/p/2013-8-20-01.html
BlockingQueue的使用 本例介绍一个特殊的队列:BlockingQueue,如果BlockQueue 是空的,从BlockingQueue取东西的操作将会被阻断进入等待状态,直到Blocki ...
- python的学习研究
2017年5月8日-----开始学习python 为什么学习python? 感觉做爬虫很酷,我又不喜欢Java,所以就学python 提升自己,入行PHP到这个月底半年,想更多的扩展自己,让自己增值 ...
- linux 常用的17个性能指标
1.Average load:Average number of processes simultaneously in Ready state during the last minute. 上 ...
- Centos 安装libreoffice 生成office 报错信息见内容
个人博客:https://blog.sharedata.info/ 错误信息:/opt/libreoffice5.2/program/soffice.bin: error while loading ...
- python模块, 包的初识
Python 模块(Module), 是一个 Python 文件,以 .py 结尾,包含了 Python 对象定义和Python语句. 模块让你能够有逻辑地组织你的 Python 代码段. 把相关的代 ...