-1

I am new to Powerbuilder , I have a hard time to get the value of Treeview parentnode after selecting its childnodes.

just like in .net (treeview.selected.parent).

can someone give me an idea.

TIA.

Marko

Viriles
  • 11
  • 1
  • 3

1 Answers1

0

A small example:

//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 

Link: PB in the TreeView control the use of skills

Eduardo G.
  • 341
  • 1
  • 7