ITPub博客

首页 > Linux操作系统 > Linux操作系统 > pb点击标题条对数据窗口排序

pb点击标题条对数据窗口排序

原创 Linux操作系统 作者:swallow0175 时间:2010-08-16 10:47:15 0 删除 编辑

********************************
*
* 目的:和windows explorer一样,点击数据窗口的标题 header ,对数据窗口进行排序
*

* 要求: 列的header 必须伪列名加 '_t'
*
* 如:
* Column Name : 'emp_id'
* Column Header : 'emp_id_t'
*
* 每次只能对一个列排序:
*
*************************************/
//数据窗口的clicked 时间:
String ls_old_sort, ls_column
Char lc_sort
/* Check whether the user clicks on the column header */
IF Right(dwo.Name,2) = '_t' THEN

ls_column = LEFT(dwo.Name, LEN(String(dwo.Name)) - 2)

/* Get old sort, if any. */

ls_old_sort = dw_1.Describe("Datawindow.Table.sort")

/* Check whether previously sorted column and currently clicked
column are same or not. If both are same then check for the sort
order of previously sorted column (A - Asc, D - Des) and change it.
If both are not same then simply sort it by Ascending order. */

IF ls_column = LEFT(ls_old_sort, LEN(ls_old_sort) - 2) THEN
lc_sort = RIGHT(ls_old_sort, 1)
IF lc_sort = 'A' THEN
lc_sort = 'D'
ELSE
lc_sort = 'A'
END IF
dw_1.SetSort(ls_column+" "+lc_sort)
ELSE
dw_1.SetSort(ls_column+" A")
END IF
dw_1.Sort()
END IF

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/36793/viewspace-671039/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-09-08

  • 博文量
    10
  • 访问量
    37789