oForm = Createobject('myForm') oForm.Show Read Events Define Class myForm As Form Height = 400 Width = 800 DataSession = 2 Add Object myGrid As myGrid With ; height = 400, Width = 800, ; recordsource = 'customer' Procedure Load Use customer Endproc Procedure QueryUnload Clear Events Endproc EndDefine Define Class myGrid As Grid LockCount = 2 && Columns to freeze on left Procedure Init With This lnVertScrollWidth = Iif(.ScrollBars < 2, 0, Sysmetric(5) ) lnRecAndDelMarkWidth = ( Iif(.DeleteMark,0.6,0) + ; iif(.RecordMark,0.6,0) ) * lnVertScrollWidth lnGridLineWidth = Iif(.GridLines < 2, 0, .GridLineWidth ) lnTotWidth = 0 For ix = 1 To .LockCount lnTotWidth = lnTotWidth + .Columns(ix).Width + lnGridLineWidth Endfor .Partition = lnTotWidth + ; Iif(.GridLines < 2, 4, .GridLineWidth ) + ; lnVertScrollWidth + max(lnRecAndDelMarkWidth, 1) .ActivateCell(1,.LockCount+1) && Setfocus to 2nd panel Do While .LeftColumn<.LockCount+1 .DoScroll(5) && Scroll right Enddo Endwith Endproc Procedure BeforeRowColChange Lparameters nColIndex With This Do Case Case Inlist(Lastkey(),9,4,2) && Right If .Panel = 0 And This.Columns(nColIndex).ColumnOrder = .LockCount Nodefault .Columns(1).SetFocus() .Panel = 1 .Columns(.LockCount+1).SetFocus() Endif If .Panel = 1 And .Columns(nColIndex).ColumnOrder=.ColumnCount Nodefault .Columns(.LockCount+1).SetFocus() .Panel = 0 .Columns(1).SetFocus() Endif Case Inlist(Lastkey(),15,19,26) && Left If .Panel = 0 If .Columns(nColIndex).ColumnOrder=1 Nodefault .Panel = 1 .Columns(.ColumnCount).SetFocus() Endif Endif If .Panel = 1 And .Columns(nColIndex).ColumnOrder=.LockCount+1 Nodefault .Panel = 0 .Columns(.LockCount).SetFocus() Endif Otherwise Endcase Endwith Endproc EnddefineCetin