* Program: HeaderClick.prg >* Author: George Tasker >* Date: October 23, 2002 - 1:50 PM >* Purpose: Inserts a command in the click >* event of a grid's header objects > >LPARAMETERS tcFileName, tcClickEvent > >* tcFileName - The form file containing the grid >* >* tcClickEvent - The code to insert >* > >LOCAL lcfilename, lccaption, lnwhandle, a_objs,; > lntop, lnleft, lni, lncolumns, lcname, lcmethod >_CLIPTEXT = tcClickEvent + CHR(13) + CHR(10) >DIMENSION a_objs[1] >IF UPPER(JUSTEXT(tcFileName)) = 'SCX' > lcfilename = JUSTFNAME(tcFileName) > lccaption = 'Form Designer - ' + LOWER(lcfilename) > MODIFY FORM (tcFileName) NOWAIT > lnwhandle = _WFindTitl(lccaption) > lntop = _WTopP(lnwhandle) + (SYSMETRIC(9) * 2) + (SYSMETRIC(4) * 2) + 14 > lnleft = _WLeftP(lnwhandle) + (SYSMETRIC(4) * 2) + 14 > ACTIVATE WINDOW (lccaption) > MOUSE CLICK AT lntop, lnleft PIXELS WINDOW (lccaption) > WAIT WINDOW "" TIMEOUT 1 && Required to get the reference to the grid > IF AMOUSEOBJ(a_objs) > 0 > IF a_objs[1].BaseClass = 'Column' > lncolumns = a_objs[1].Parent.ColumnCount > lcname = a_objs[1].Parent.Name + '.Column' > FOR lni = 1 TO lncolumns > lcmethod = lcname + TRANSFORM(lni) + '.Header1.Click' > MODIFY FORM (tcFileName) NOWAIT METHOD &lcmethod > ACTIVATE WINDOW 'Header1.Click' > lnwhandle = _WFindTitl('Header1.Click') > = _WSelect(lnwhandle) > = _EdPaste(lnwhandle) > = _WClose(lnwhandle) > DO WHILE _WOnTop() = lnwhandle > ENDDO > NEXT > ENDIF > ENDIF >ENDIF >RETURNNote, however, I did try other means of trying paste the code into the method/event code window, including KEYBOARD...and SYS(1500).