自动排序的问题

huyu361 2006-06-30 04:30:32
我的数据窗口是grid格式的 我想每点各列就能按要求自动排序
就象exsl 是的 问怎么弄新人详细点谢谢!!
...全文
216 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cab_1128 2006-07-03
  • 打赏
  • 举报
回复
我想楼主的意思应是点点列标题就自动排序吧。
huyu361 2006-07-03
  • 打赏
  • 举报
回复
is_OrderCol在那里定义呀
xyqiqi 2006-07-01
  • 打赏
  • 举报
回复
string ls_AddPict, ls_CurObj, ls_Picture, ls_CurCol
integer li_PictPos

ls_CurObj = String(dwo.Name)
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 // Different Column
This.Modify("DESTROY p_" + is_OrderCol)
is_OrderCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
ls_Picture = "bmp\ORDERUP.BMP"
is_SortType = "A" // Ascending sort
li_PictPos = Integer(This.Describe(ls_CurObj + ".X"))+ (Integer(This.Describe(ls_CurObj + ".Width")) - 70)
ls_AddPict ='create bitmap(band=foreground filename="' + ls_Picture + '" ' + &
' x="' + String(li_PictPos) + "~tInteger(describe('" + is_OrderCol + &
".X')) + (Integer(describe('" + is_OrderCol + ".Width'))" + ' - 70)" y="24" ' + &
' height="33" width="51" border="0" name=p_' + is_OrderCol + ' visible="1")'
This.Modify(ls_AddPict)
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
Else
If is_SortType = "A" Then
ls_Picture = "img\down_sort.bmp"
is_SortType = "D"
Else
ls_Picture = "img\up_sort.bmp"
is_SortType = "A"
End If
This.Modify('p_' + is_OrderCol + '.filename = "' + ls_Picture + '"')
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
End If
End If

点击的时候,与老列比较,如果是原先的列,排列顺序就与老列相反,如果是新列,就重新排序。
ls_Picture是加载的图片,即点击列的时候,会在列的右边出现一个向上或者向下的图片。
huyu361 2006-07-01
  • 打赏
  • 举报
回复
新人详细点
polestarxu 2006-06-30
  • 打赏
  • 举报
回复
在clicked事件里面写代码。 dw.setsort(columnname) dw.sort()

609

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧