我是PowerBuilder的新手,我很难在选择其childnodes之后获得treeview parentnode的值。
就像.net(treeview.selected.parent)一样。
有人可以给我一个主意。
tia。
Marko
一个小示例:
//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
链接:Treeview中的PB控制技能的使用