Partition

Specifies where the grid's left and right panels split.

Usage

grdGrid.Partition = nWhere2Split
nWhere2Split = grdGrid.Partition

Parameter

Value

Meaning

nWhere2Split

Numeric

Specifies the pixel location where the left and right panels are split. This is always expressed in pixels and is not affected by ScaleMode.


The partition must have a value from 0 (for no split) to a value slightly less than the grid's Width property.

Graphically, you can drag the partition all the way to the right, where it takes a value 2 pixels less than the width. With one pixel each for the black lines on the left and right of the grid, that makes sense. Programmatically, you can't go as far. You start getting problems when you run into the vertical scrollbar. In the range of widths where the partition displays on top of the scrollbar, setting the partition width works, but it generates a beep and no error. Setting the partition to more than 2 pixels less than the width generates an error. We're sure the folks who tested this one were using a grid with no scrollbar!


To be able to set Partition to the full range of the grid, set Scrollbars to 0 and then restore it after setting Partition where you like. You can use SYSMETRIC(5) to determine the width of the scrollbars.In VFP 3.0, there seems to be no way to turn off the partition completely. The SplitBar property was introduced in VFP 5. We've had more than a few clients confuse themselves terribly by messing with the partition and then being unable to make things right; it's great to be able to protect them from themselves. If SplitBar is set to .F., the setting of Partition is ignored.In versions of FoxPro before 6.0, you can't even detect the partition being moved, except by trapping the value of Partition in MouseDown and checking it in each MouseUp. In 6.0, we thought of two new possibilities. You could test for the "SplitBar" value in GridHitTest. The only problem with this is that Partition is not assigned new values while the splitbar is being dragged, only when it stops, so you might as well stick with the MouseDown, MouseUp trick. The other idea we had was to add a Partition_Assign method to the grid.

Partition_Access does not fire when you drag the SplitBar gadget around, nor when you release it. Like many built-in properties, it seems like the changing of this value cannot be trapped with the Access method.


While we would hardly ever consider using a partitionable grid in an application, the fine control we have is reassuring.

Example

grdGrid1.Partition = 143

See Also

Access, Assign, GridHitTest, Panel, PanelLink, ScrollBars, SplitBar


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .