**replace headers with my header class **enables click methods in header LOCAL lcCaption For Each oColumn In Thisform.grdmy1.Columns With oColumn lcCaption= ALLTRIM( .Header1.caption) .removeobject("header1") .Newobject("header1", "_mygridheader", "myheader.prg") .header1.caption=(lcCaption) Endwith Endforwhere myheader.prg is:
define class _mygridheader as header procedure DblClick IF TYPE(this.parent.controlsource)!='M' thisform.zsortcolumn(this.Parent.controlsource,this.Parent.columnorder) ELSE thisform.omessage.warning(PROPER('The Data source of this column '+; 'is a MEMO field. This type of sorting is currently not available. ')) endif endproc enddefineand zsortcolumn is:
LPARAMETERS cSortField, nColumn LOCAL lcIndexField, lnActiveColumn lcIndexField=ALLTRIM(m.cSortField) lcIndexField=SUBSTR(lcIndexField,AT('.',lcIndexField)+1) IF UPPER(ALLTRIM(thisform.zlastorder))=='DESC' thisform.zlastorder='ASC' &&ENDING' ELSE thisform.zlastorder='DESC' &&ENDING' ENDIF thisform.zSearch((thisform.cworkarea),'RESULTS',(lcIndexField+' '+thisform.zlastorder)) thisform.grdmy1.ActivateCell(thisform.grdmy1.ActiveRow,m.nColumn) thisform.grdmy1.SetFocus()The header click on the column just performs another search with an order set. It's like setting the order ruins my next search.