For ix = 1 ToThis.ColumnCount lcIx = Alltrim(Str(ix)) Bindevent(This.Column&lcIx..header1,'click',This,'m_headerClick',1) Bindevent(This.Column&lcIx..text1,'dblclick',This,'m_DoubleClick',1) Bindevent(This.Column&lcIx..text1,'rightclick',This,'m_rightClick',1) Endforand then to identify where the action took place use aevents
Aevents( laWhichEvent, 0 ) lnColumnNumber = laWhichEvent[1,1].Parent.ColumnOrder lcColumnNumberCharacter = Alltrim(Str(lnColumnNumber))>Hi All,
>this.recordsource = 'MyTable' > >Text To cClassCode noshow >define class MyHeader as header > name = 'MyHeader' > proc Click > * Create an Index and use it > local lcFileName, lcField > lcFileName = 'mhtest' + sys(3) + '.idx' > lcField = this.caption > index on &lcField to (lcFileName) > thisform.refresh() > EndProc >EndDefine >EndText >StrToFile(cClassCode,"c:\xx.prg") >Set Library To c:\xx.prg ADDITIVE > >local lnFields, laFields[1], lnI > with this > * For every field in the chosen table add a column > lnFields = afields(laFields) > .ColumnCount = 0 > for lnI = 1 to lnFields > .AddColumn(lnI) > with .Columns[lnI] > * Remove the old header and add ours > .RemoveObject('Header1') > .AddObject('Header1', 'MyHeader') > .Header1.Caption = laFields[lnI, 1] > .ControlSource = 'MyTable.' + laFields[lnI, 1] > endwith > endfor > EndWith >* oGridHeader = NewObject("MyHeader","c:\xx.prg") >* MessageBox(oGridHeader) >>
>use ? alias MyTable >if not used() > wait window 'No table was chosen' > return .F. >endif >>