下了,看不到任何代码,运行后出错误!望指教,谢谢!@
代码在类里,运行表单demo应该可以的。
下面就是相关的代码:
If This.isSort = .F.
Return
Endif
*!* 用Aevents函数返回呼叫这个事件的对象(同BindEvents绑定使用),也就是判断哪个Column的Header被点击
*!* 调用grd.GetFieldTag判断该字段是否已索引
Local Array laEvents[1]
Try
Private lcSourceAlias,lcControlSource,lcField,lcTag,Ftag,lnBuffer,lcSortGrc
Local lcSourceAlias,lcControlSource,lcField,lcTag,Ftag,lnBuffer,lcSortGrc
Aevents(laEvents,0)
lcSourceAlias = laEvents[1,1].Parent.Parent.RecordSource
lcControlSource = laEvents[1,1].Parent.ControlSource
lcSourceAlias = Iif(!Empty(lcSourceAlias),lcSourceAlias,Substr(lcControlSource,1,At(".",lcControlSource)-1))
lcSourceAlias = Iif(!Empty(lcSourceAlias),lcSourceAlias,Alias())
lcField = Substr(lcControlSource,At(".",lcControlSource)+1)
*--
If Empty(lcSourceAlias)
Return
Endif
If Empty(lcField)
Return
Endif
lcTag = "SortTag"
Ftag = This.GetFieldTag(lcSourceAlias,lcField)
Select (lcSourceAlias)
*--
lnBuffer = CursorGetProp("Buffering")
If lnBuffer > 3
CursorSetProp("Buffering" ,3)
Endif
*--
lcSortGrc = This.SortGrc
If !Empty(This.SortGrc)
This.&lcSortGrc..Header1.Picture=""
Endif
This.SortGrc= laEvents[1,1].Parent.Name
Select(lcSourceAlias)
If Empty(Ftag)
If laEvents[1,1].Tag = "Down"
Inde On &lcField Tag &lcTag Descending
laEvents[1,1].Picture = Iif(File("Down.bmp"),"Down.bmp","")
laEvents[1,1].Tag = "Up"
Else
Inde On &lcField Tag &lcTag Ascending
laEvents[1,1].Picture = Iif(File("Up.bmp"),"Up.bmp","")
laEvents[1,1].Tag = "Down"
Endif
Else
If laEvents[1,1].Tag = "Down"
Set Order To (Ftag) Descending
laEvents[1,1].Picture = Iif(File("Down.bmp"),"Down.bmp","")
laEvents[1,1].Tag = "Up"
Else
Set Order To (Ftag) Ascending
laEvents[1,1].Picture = Iif(File("Up.bmp"),"Up.bmp","")
laEvents[1,1].Tag = "Down"
Endif
Endif
If lnBuffer > 3
CursorSetProp("Buffering" ,lnBuffer)
Endif
Go Top
This.Refresh
Catch
Endtry