麻烦吹版再看下,十分感谢
我建立了个grid的类,把myclick和msortad的属性加在了grid里内,
因为表单上经常会并列显示多个数据表单,所以每个表单的数据源是
不确定的。
所以想请吹版打开程序看看。
**form.load
SELECT *from 客户名单 INTO CURSOR pzlsb1
**grid.myclick
LOCAL mSortCol[1],mCmd
IF (AEVENTS(mSortCol,0) > 0)
&&将对象赋值给数组变量
IF (VARTYPE(mSortCol[1])=="O") AND (PROPER(mSortCol[1].BaseClass)=="Header")
mField=(mSortCol[1].Parent.ControlSource)
&&取点击表头的Header
mCursor=SUBSTR(mField,1,AT('.',mField)-1)
&&取临时表
mField=SUBSTR(mField,AT('.',mField)+1)
&&取排序字段
mCmd='select *from '+;
mCursor+;
' order by '+;
mField+;
IIF(this.mSortAD, " ASC ", " DESC ") +;
" INTO cursor "+mCursor
MESSAGEBOX(mCmd)
this.RecordSource = ""
EXECSCRIPT(mCmd)
this.RecordSource =mCursor
this.SetFocus
this.mSortAD = !this.mSortAD &&自定义表单属性mSortAD,升降序切换
ENDIF
ENDIF
**grid.init
FOR EACH oColumn IN this.Columns
BINDEVENT(oColumn.Header1, "Click", this, "myClick")
ENDFOR
[此贴子已经被作者于2018-3-14 15:31编辑过]