Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPLITTING the GRID
Message
From
23/12/2002 06:06:44
 
 
To
23/12/2002 05:27:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00735336
Message ID:
00735340
Views:
10
We can split the grid by iusing Grid.SplitBar property & show it as different columns.

What I need is to be able to freeze a coulmn or two.


You can do this, but it is not easy nor is it pretty < s >. You need to call a method from both the grid's scrolled event and its AfterRowColChange that checks to see which panel of the grid your are in when the grid is scrolled horizontally and issues a DoScroll() to keep the correct columns in view.

You may also want to check out an article by Dan LeClaire that was in FoxPro Advisor back in 1997 that presented a class to do this.

Or you can wait until VFP 8.0 comes out because this behavior will be in the product for free.

Alternatively, you can use this code if you need to lock only a single column:

AfterRowColChange:
WITH This
  *** if we scrolled horizontally, adjust the column order
  *** so the leftmost column stays the leftmost column
  IF .RowColChange > 1
    .Columns( .nFirstColumn ).ColumnOrder = .LeftColumn
  ENDIF
ENDWITH
Scrolled:
LPARAMETERS nDirection
WITH This
  *** if we scrolled horizontally, adjust the column order
  *** so the leftmost column stays the leftmost column
  IF nDirection > 3
    .Columns( .nFirstColumn ).ColumnOrder = .LeftColumn
  ENDIF
ENDWITH
Init:
LOCAL lnCol
DODEFAULT()
WITH This
  *** Find out which column is the leftmost column
  *** when the grid is instantiated and save it
  FOR lnCol = 1 TO .ColumnCount
    IF .Columns[ lncol ].ColumnOrder = 1
      .nFirstColumn = lnCol
      EXIT
    ENDIF
  ENDFOR
ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform