with This .PanelLink = .F. .Panel = 0 .ScrollBars = 1 .Panel = 1 .PanelLink = .T. .Partition = .Column1.Width + .Column2.Width + 2 endwith- Scrolled(), which is fired whenever the user scrolls the grid, ensures the appropriate columns are displayed in the appropriate panel by forcing the grid to scroll unwanted columns out of view if necessary.
LPARAMETERS nDirection local lnI Thisform.LockScreen = .T. with This do case * If either of the first two columns is visible in the * right panel, scroll until they're no longer there. case .Panel = 1 and .LeftColumn <= 3 for lnI = .LeftColumn to 2 .DoScroll(5) next lnI * If any column but the first two is visible in the left * panel, scroll until they're no longer there. case .Panel = 0 and .LeftColumn > 1 for lnI = .LeftColumn to 2 step - 1 .DoScroll(4) next lnI endcase endwith Thisform.LockScreen = .F.- Column1.Text1.GotFocus() ensures the right panel doesn't show the first two columns by setting focus to column 3 (the first column in the right panel) if necessary. This makes the grid act more like a spreadsheet.
with This.Parent.Parent if .Partition <> 0 and .Panel = 1 Thisform.LockScreen = .T. .Column3.SetFocus() if .LeftColumn <> 3 .DoScroll(5) endif .LeftColumn <> 3 Thisform.LockScreen = .F. endif .Partition <> 0 ... endwith- Column1.Text1.LostFocus() moves to the third column (the first column we want displayed in the right panel). This makes the grid act more like a spreadsheet.
with This.Parent.Parent if .Partition <> 0 and .Panel = 0 .Panel = 1 .Column3.SetFocus() endif .Partition <> 0 ... endwith- Column2.Text1.When() prevents focus from being set to the Name column:
return .F.
- The columns in the right panel (column 3 and higher) contain a textbox class with the following When code to prevents the textbox from receiving focus if there isn't a partition or if focus is in the left panel:with This.Parent.Parent return .Partition = 0 or .Panel = 1 endwithKind of ugly, but it works :)