回 帖 发 新 帖 刷新版面

主题:help me (online wait)

如何在数据窗口中实现按某一列然后该列的值自动进行排序

回复列表 (共4个回复)

沙发

定义实例变量
String is_col=''
Int ii_time=0

在数据窗口的clicked事件
String ls_pos,ls_col,ls_format
Long ll_pos
ls_pos = dwo.Name//取点击的对象
ll_pos = Pos(ls_pos,'_t')//对于列标题,取得的对象是列名+”_t”
If ll_pos >0 Then
    ls_col = Left(ls_pos,ll_pos -1)
    If ls_col=is_col Then
        If ii_time=0 Then
            ii_time = 1
            ls_format = ls_col+" A"
        Else
            ii_time=0
            ls_format = ls_col+" D"
        End If
    Else
        ii_time = 0
        ls_format = ls_col+" A" 
    End If
    is_col = ls_col
    dw_1.SetSort(ls_format)
    dw_1.Sort()
End If

板凳

同意楼上兄台的方法.

3 楼

最好还是设置一个通用的排序窗口!
每次调用只要,openwithparm(w_sort,dw_1)

点击行头排序,功能有限(只能实现单种排序),而且繁琐!

对于过滤,查询,替换、查找。。。都可以!

4 楼

最好是写成函数,在开发的软件中回经常用到,写成函数每次直接调用就可以了

我来回复

您尚未登录,请登录后再回复。点此登录或注册