通用实例,数据窗口对象:
$PBExportHeader$uo_dwsort.sru
$PBExportComments$Datawindow userobject with sort functionality
forward
global type uo_dwsort from datawindow
end type
end forward
global type uo_dwsort from datawindow
integer width = 1303
integer height = 904
integer taborder = 2
string dragicon = "dragrec.ico"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type
global uo_dwsort uo_dwsort
type prototypes
end prototypes
type variables
Public:
boolean MultiSelect = False
long LastRow
integer ii_ShowStatus = 50
If Row = 0 AND This.Describe(ls_CurObj + ".Text") <> "!" AND This.Describe(ls_CurObj + ".Band") = "header" Then // Valid header object?
ls_CurCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
If is_OrderCol <> ls_CurCol Then
is_OrderCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
of_asc(li_linePos)
is_SortType = "A"
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
Else
If is_SortType = "A" Then
li_LinePos -= 20
of_des(li_LinePos)
is_SortType = "D"
Else
of_asc(li_LinePos)
is_SortType = "A"
End If
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
End If
End If