//Asumir que ya hemos conectado y recuperado datawindow
// y has creado el control TreeView (tv_1)
LONG ll_handle0, ll_nivel
STRING ls_desc_item
//raiz del treeview
ll_handle0=tv_1.InsertItemLast(0,"ITEMS",1)
FOR i=1 TO dw_items.RowCount()
ll_nivel=dw_items.GetItemNumber(i,"nivel")
ls_desc_item=dw_items.GetItemString(i,"desc_item")
ll_handle0=tv_1.InsertItemLast(ll_handle0,ls_desc_item,ll_nivel)
NEXT