您的位置:程序门 -> delphi -> vcl组件开发及应用



誰能幫我看一下這個treeview的取值有什麼問題


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


誰能幫我看一下這個treeview的取值有什麼問題[已结贴,结贴人:popmailzjw]
发表于:2007-04-24 11:06:26 楼主
function   getsectfromtree(node:   ttreenode):   string;
var
    n:   ttreenode;
begin
    if   node   =   nil   then
        result   :=   ' '
    else
        if   node.haschildren   then
        begin
            n   :=   node.getfirstchild;
            while   n   <>   nil   do
            begin
                result   :=   result   +   getsectfromtree(n);
                n   :=   node.getnextchild(n);
            end;
        end
        else
            result   :=   (node.text)   +   '^ ';
end;
发表于:2007-04-24 11:10:111楼 得分:5
result   :=   (n.text)   +   '^ '
发表于:2007-04-24 11:19:062楼 得分:0
不對,應該還是哪裡有問題,他輸出的結果會是
第一個字節點下的所有記錄   +   第一,第二   +   第一,第二,第三   +   ....
发表于:2007-04-24 11:27:213楼 得分:0
function   getsectfromtree(node:   ttreenode):   string;
var
    n:   ttreenode;
begin
    if   node   =   nil   then
        result   :=   ' '
    else
        if   node.haschildren   then
        begin
            n   :=   node.getfirstchild;
            while   n   <>   nil   do
            begin
                result   :=     getsectfromtree(n);
                n   :=   node.getnextchild(n);
            end;
        end
        else
            result   :=result   +   (node.text)   +   '^ ';
end;

发表于:2007-04-24 11:28:184楼 得分:5
:)
发表于:2007-04-24 11:28:355楼 得分:0

這樣就對了,鬱悶了我一上午,終於搞定了
发表于:2007-04-24 11:31:416楼 得分:10

function   getsectfromtree(node:   ttreenode):   string;
var
    n:   ttreenode;
begin
    if   node   =   nil   then
        result   :=   ' '
    else
    begin  
        result   :=   (node.text)   +   '^ ';
        if   node.haschildren   then
        begin
            n   :=   node.getfirstchild;
            while   n   <>   nil   do
            begin
                result   :=   result   +   getsectfromtree(n);
                n   :=   node.getnextchild(n);
            end;
        end;
  end;


快速检索

最新资讯
热门点击