Powerbuilder:如何在选择其子节点时获得Treeview Parentnode的价值?

时间:2017-03-14 06:41:06

标签: powerbuilder

我是Powerbuilder的新手,在选择其子节点后,我很难获得Treeview parentnode的值。

就像.net(treeview.selected.parent)一样。

有人可以给我一个想法。

TIA。

马尔科

1 个答案:

答案 0 :(得分:0)

一个小例子:

//To determine this you can check the level they have for example:
treeviewitem tvi 
long l_tvi 
//We locate the selected item
l_tvi = tv_1.finditem(CurrentTreeItem!,0) 
if l_tvi>0 then 
    tv_1.getitem(l_tvi,tvi)//We extract it

    //The LEVEL property will tell you what level you are in
    messagebox('Nivel',string(tvi.level)) 
end if 

//Another way to identify if the item has a parent is:

long l_tvi,l_tvi_parent 
//We locate the selected item
l_tvi = tv_1.finditem(CurrentTreeItem!,0) 
if l_tvi>0 then 
    l_tvi_parent = tv_1.finditem(ParentTreeItem!,l_tvi) 
    if l_tvi_parent > 0 then 
        //The item has a parent
    else 
        //Item has no parent
    end if 
end if 

链接:PB in the TreeView control the use of skills