PB数据窗口实现点击标题栏字段时按相应字段升/降序排序

来源:互联网 发布:应用程序劫持软件 编辑:程序博客网 时间:2024/06/05 19:52
将以下代码复制到想要排序的数据窗口的clicked事件中可实现:
//***********************************按标题头排序********************************//
//*****注:为避免点击标题时所在列变黑色,应将数据窗口的column moving属性去掉******//
//*********************************************************************************//
String ls_name,ls_text
Integer i,li_count,li_num,li_num1
If row <= 0 Then
If This.Describe(dwo.Name + ".Band") = 'header' Then
li_count = Integer(This.Describe("Datawindow.Column.Count"))
for i = 1 to li_count
ls_name = This.Describe("#" + String(i) + ".Name")
ls_text = This.Describe(ls_name + '_t.Text')
li_num = PosW(ls_text,'↑')
li_num1 = PosW(ls_text,'↓')
If li_num > 0 Then
ls_text = ReplaceW(ls_text,li_num,lenW('↑'),'')
ElseIf li_num1 > 0 then
ls_text = ReplaceW(ls_text,li_num1,lenW('↓'),'')
End If
If dwo.Name = (ls_name + '_t') then
If li_num > 0 Then
This.Modify(ls_name + "_t.Text='" + ls_text + "↓'")
This.SetSort(ls_name + " D")
This.Sort()
ElseIf li_num1 > 0 then
This.Modify(ls_name + "_t.Text='" + ls_text + "↑'")
This.SetSort(ls_name + " A")
This.Sort()
Else
This.Modify(ls_name + "_t.Text='" + ls_text + "↑'")
This.SetSort(ls_name + " A")
This.Sort()
End If
Else
If (li_num + li_num1) > 0 Then
This.Modify(ls_name + "_t.Text='" + ls_text + "'")
End If
End If
Next
End If
End If
原创粉丝点击