Though this is not an extremely practical solution as it stands, it does show in great detail how to position a grid on a particular column/row using many of the grid's methods, events and properties. So if you've ever wondered how you can manipulate what columns/rows are shown in a grid through code this is for you. Cut-N-Paste the code below into a prg file and run it from with VFP to see how it works.
PUBLIC oForm oForm = CREATEOBJECT("clshookedgrids") oForm.show()
DEFINE CLASS clshookedgrids AS form Top = 0 Left = 0 Height = 294 Width = 620 DoCreate = .T. Caption = "Form1" Name = "Form1"
ADD OBJECT label1 as label WITH ; Caption = "Move around in this grid and watch what happens in the second grid below", ; AutoSize = .T., ; Left = 25, ; Top = 10, ; ForeColor = RGB(0,0,255), ; Name = "Label1"
ADD OBJECT grid1 AS grid WITH ; ColumnCount = 21, ; Height = 108, ; Left = 25, ; RecordSource = "crsOne", ; Top = 27, ; Width = 569, ; Name = "Grid1"
ADD OBJECT grid2 AS grid WITH ; ColumnCount = 21, ; Enabled = .T., ; Height = 108, ; Left = 25, ; RecordSource = "crsTwo", ; Top = 159, ; Width = 569, ; Name = "Grid2"
PROCEDURE Load *!* Need some fake data to test this
PROCEDURE Init *!* Because I am too lazy to recaption the headers FOR i = 1 TO 21 thisform.grid1.Columns(i).header1.Caption = "FIELD " + ALLTRIM(STR(i)) thisform.grid2.Columns(i).header1.Caption = "FIELD " + ALLTRIM(STR(i)) ENDFOR ENDPROC