当前位置: 代码迷 >> PB >> PB12 Treeview Datawindow 有关问题
  详细解决方案

PB12 Treeview Datawindow 有关问题

热度:46   发布时间:2016-04-29 06:52:55.0
PB12 Treeview Datawindow 问题
请问这个DW树形结构支持多层吗?
节点1
  |
   ——节点2
          |
          ——节点3 ....
另外我的PB12的版本是 12.0 build 5530.是否有高级点的版本?如有麻烦各位大侠奉献下。。。不胜感激。。。bi[email protected]

------解决方案--------------------
引用:
在弱弱的问下...树形DW必须点前面的+号才可以展开树吗?能否点Label就直接展开树???


只能通过代码实现,在dw的clicked事件中写:
string ls_band
ls_band = this.GetBandAtPointer()
long ll_row
int li_level, li_pos
li_pos = pos(ls_band , "~t")  
if li_pos > 0 then
ll_row = long (mid (ls_band, li_pos + 1 , len(ls_band)))
ls_band = mid(ls_band , 1 , li_pos - 1)
if left(ls_band, 11) = 'tree.level.' then
li_level = integer(mid(ls_band, 12))
end if
if li_level <= 0 then return

if this.isexpanded( ll_row, li_level) then
this.collapse(ll_row, li_level)
else
this.expand(ll_row, li_level)
end if
end if

------解决方案--------------------
分享一下,双击那一层则自带收缩 (数据窗口 DoubleClicked 事件中处理)



string ls_dwProcessing,ls_band
// 树型 dw 的 展开,收缩 处理
ls_dwProcessing=this.describe('DataWindow.Processing')
If ls_dwProcessing='8'  or ls_dwProcessing='9' Then
ls_band=this.describe(dwo.Name+".band")
//tree.level.1
//n_cst_string 
If pos(ls_band,'tree.level.') >0 Then
n_cst_string  lstr_c
string ls_parstr[],ls_bandrow[]
int li_level,li_row
lstr_c.of_parsetoarray(ls_band,'.',ls_parstr)//PFC 对象 把字串 分配成数组(也可以自行写)
If upperbound(ls_parstr[])>=3 Then
If isnumber(ls_parstr[3])Then
li_level=integer(ls_parstr[3])
//describe("evaluate(' first( getrow() for group 1 )',"+string(getrow())+")")
//describe("evaluate(' first( getrow() for group 1 )',"+first( getrow() for group 1 )+")")
//li_row= this.getrow()//long(describe("evaluate(' first( getrow() for group "+string(li_level)+" )',compute_3)"))
//取双击的所在 band 的行
ls_band=GetBandAtPointer()
lstr_c.of_parsetoarray(ls_band,'~t',ls_bandrow)
If upperbound(ls_bandrow[])>=2 Then 
li_row=long(ls_bandrow[2])
If li_row=0 Then li_row= this.getrow()
Else
li_row= this.getrow()
End If
If this.isexpanded( li_row, li_level) Then 
this.CollapseAllChildren(li_row,li_level)
//this.CollapseAll()
Else
this.ExpandAllChildren(li_row,li_level)
//this.ExpandAll()
End If

End If
End If
End If
End If

  相关解决方案