TcxTreeList的使用心得。
来源:互联网 发布:星际玩家什么梗 知乎 编辑:程序博客网 时间:2024/06/07 06:26
Dennica
Можно и так. Только нужно проверку поставить на пустой ATreeList. И нужно все таки понять для чего Data.
И вообще я не пойму на кой тебе при такой теме TreeList ?
while not Eof do begin
with tlAvailable.Add do begin
Values[0] := FieldValues['id'];
Values[1] := FieldValues['name'];
end;
Next;
end;
Add, Add ... - где построение дерева, где родитель, где дочерние узлы? Используй грид и не морочь голову.
Дерево строится где-то таким образом
function GetNodeFromData(Data: Integer): TcxTreeListNode;
var
Node: TcxTreeListNode;
begin
Result := nil;
with TreeList do
begin
if Count = 0 then
Exit;
Node := Items[0];
while Assigned(Node) do
begin
if Integer(Node.Data) = Data then
begin
Result := Node;
Break;
end;
Node := Node.GetNext;
end;
end;
end;
procedure LoadTree;
var
Node: TcxTreeListNode;
begin
with MainDM, TreeList do
begin
Node := Add(nil,Pointer(0));
Node.Texts[0] := 'Содержание';
with TpFIBDataSet.Create(nil) do
try
Database := dbBase;
Transaction := trRd;
SQLs.SelectSQL.Add('SELECT * FROM Таблица ORDER BY ID');
Active := True;
while not Eof do
begin
Node := AddChild(GetNodeFromData (FieldByName('Родительский ID').AsInteger),
Pointer(FieldByName('ID') .AsInteger));
Node.Texts[0] := FieldByName('Текст Нода').AsString;
Next;
end;
Active := False;
GotoBOF;
FocusedNode.Expand(False);
finally
Free;
end;
end;
end;
var
Node: TcxTreeListNode;
begin
Result := nil;
with TreeList do
begin
if Count = 0 then
Exit;
Node := Items[0];
while Assigned(Node) do
begin
begin
Result := Node;
Break;
end;
Node := Node.GetNext ;
end;
end;
end;
Можно и так. Только нужно проверку поставить на пустой ATreeList. И нужно все таки понять для чего Data.
И вообще я не пойму на кой тебе при такой теме TreeList ?
while not Eof do begin
with tlAvailable.Add do begin
Values[0] := FieldValues['id'];
Values[1] := FieldValues['name'];
end;
Next;
end;
Add, Add ... - где построение дерева, где родитель, где дочерние узлы? Используй грид и не морочь голову.
Дерево строится где-то таким образом
function GetNodeFromData(Data: Integer): TcxTreeListNode;
var
Node: TcxTreeListNode;
begin
Result := nil;
with TreeList do
begin
if Count = 0 then
Exit;
Node := Items[0];
while Assigned(Node) do
begin
if Integer(Node.Data) = Data then
begin
Result := Node;
Break;
end;
Node := Node.GetNext;
end;
end;
end;
procedure LoadTree;
var
Node: TcxTreeListNode;
begin
with MainDM, TreeList do
begin
Node := Add(nil,Pointer(0));
Node.Texts[0] := 'Содержание';
with TpFIBDataSet.Create(nil) do
try
Database := dbBase;
Transaction := trRd;
SQLs.SelectSQL.Add('SELECT * FROM Таблица ORDER BY ID');
Active := True;
while not Eof do
begin
Node := AddChild(GetNodeFromData
Pointer(FieldByName('ID')
Node.Texts[0] := FieldByName('Текст Нода').AsString;
Next;
end;
Active := False;
GotoBOF;
FocusedNode.Expand(False);
finally
Free;
end;
end;
end;
function GetNodeFromNodeText(Text: String): TcxTreeListNode;
var
Node: TcxTreeListNode;
begin
Result := nil;
with TreeList do
begin
if Count = 0 then
Exit;
Node := Items[0];
while Assigned(Node) do
begin
if Node.Texts[0] = Text then
begin
Result := Node;
Break;
end;
Node := Node.GetNext ;
end;
end;
end;
- TcxTreeList的使用心得。
- 解决TcxTreeList使用的几个问题
- freemarker的使用心得,freemarker使用心得
- TcxTreeList显示复选框
- 异常的使用心得
- 使用JSP的心得
- Ndoc的使用心得
- Quartz的使用心得
- treeview 的使用心得
- Cookies的使用心得
- pd11的使用心得
- PDFCreator的使用心得
- DOM的使用心得
- 使用wordpress的心得
- Windbg的使用心得
- xtrareport的使用心得
- shared_ptr的使用心得
- CCHMLView的使用心得
- cursor又
- 标记一下(ACE源码片段)
- 利用VSTS实现Daily Build
- Bliki 索引
- test
- TcxTreeList的使用心得。
- 发布blog的十条黄金法则
- 怎样保护你的.NET程序
- asp split 函数的应用
- 阻止 Visual Basic .NET 或 C# 代码的反向工程
- 小正数,避免极小截断误差
- The furthest distance in the world
- 管理知识的培训(1)
- 小数问题