- If you wanted to do something when you click the header, then use header's click event
- If you wanted to do something when you reposition column, then use column's moved event
Local oForm
oForm=Newobject("Form1")
oForm.Show
Read Events
Return
Define Class Form1 As Form
Height = 390
Width = 500
AutoCenter = .T.
Caption = 'Column Moved or Header Simply Clicked?'
Add Object grid1 As Grid With ;
GridLines = 0, ;
Height = 328, ;
Left = 10, ;
Top = 50, ;
Width = 480,;
GridLines = 3,;
DeleteMark = .F.,;
GridLineColor = Rgb(192,192,192),;
FontName = 'Tahoma',;
FontSize = 8, Anchor = 15, AllowCellSelection = .F.
Procedure Load
Set Talk Off
Set Safety Off
Close Databases All
Select company,contact,Title From (Home(2)+"data\customer") Where Recno() < 50 Into Cursor junk
Use In Select('customer')
Endproc
Procedure grid1.Init
With This
.RecordSourceType = 6
.RecordSource = 'junk'
.Column1.Header1.Caption = 'Column1'
.Column2.Header1.Caption = 'Column2'
.Column3.Header1.Caption = 'Column3'
.SetAll('Width',150,'Column')
For lnloop = 1 To .ColumnCount
Bindevent(.Columns(m.lnloop),'Moved',Thisform,'_Moved')
Next
Endwith
Endproc
Procedure _Moved
Messagebox('Moved!')
Endproc
Procedure Destroy
Clear Events
Endproc
Enddefine
No comments:
Post a Comment