貝殼兒的寶貝匣子

有一天,可愛的小狗狗問媽媽:幸福是什麼? 狗媽媽說:幸福其實就是你的尾巴. 小狗狗拼命咬自己的尾巴,但是它都咬不到 "媽媽,為什麼我抓不住我的幸福?" "傻孩子,抬起頭去走,幸福就會跟著你的!"
posts - 7, comments - 1, trackbacks - 0, articles - 0
  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

關於cxDBTreeList的父節點.

Posted on 2005-11-12 09:18 貝殼兒 阅读(2351) 评论(1)  编辑 收藏 引用 所属分类: Delphi编程
看到一些財務軟件的科目樹狀結構中.經常抓取子科目時,也會把父科目的文本也加上,顯示出來,
研究了幾個小時,終於得出.

var
    S:string;
    aNode:TcxTreeListNode;
    i:Integer;
begin
aNode:=cxDBTreeList1.FocusedNode;
for i:=aNode.Level downto 0 do
  begin
    if i=cxDBTreeList1.FocusedNode.Level then
       S:=aNode.Values[1]
    else
       S:=aNode.Values[1]+'->'+S;
    aNode:=aNode.Parent;
  end;
ShowMessage(S);
end;

Feedback

# 把它編寫成了函數  回复  更多评论   

2005-11-14 08:45 by 貝殼兒1
function TAPubSelectForm.ShowCxDBTreeListNodeValues(
ACxDBTreeList: TcxDBTreeList): string;
var
S:string;
aNode:TcxTreeListNode;
i:Integer;
begin
if ACxDBTreeList.Visible then
if ACxDBTreeList.FocusedNode.HasChildren then //只顯示最底層的
Exit;
aNode:=ACxDBTreeList.FocusedNode;
for i:=aNode.Level downto 0 do
begin
if i=ACxDBTreeList.FocusedNode.Level then
S:=aNode.Values[1]
else
S:=aNode.Values[1]+'->'+S;
aNode:=aNode.Parent;
Result:=S;
end;
end;
只有注册用户登录后才能发表评论。