// Event: clicked
// Description: 双击列标题时,按该列排序(第一次升序,第二次降序)

string ls_objects
integer li_pos
string ls_dwoname
string ls_sort_old,ls_sort_new

ls_objects=lower(this.object.datawindow.objects)
ls_sort_old=lower(Trim(this.Describe("Datawindow.Table.Sort")))

if dwo.type='text' then
   li_pos=pos(lower(dwo.name),"_t")
   if li_pos>0 then
     ls_dwoname=lower(left(dwo.name,li_pos -1))
       if pos(ls_objects,ls_dwoname)>0 then
          ls_sort_new=ls_dwoname+" a"
          if ls_sort_new=ls_sort_old then
             ls_sort_new=ls_dwoname+" d"
          end if
          this.setsort(ls_sort_new)
          this.sort()
       end if
   end if
end if

未测试,应该行

来自:https://www.cnblogs.com/yh-xiaoxiami/p/13869809.html