ADD CLASS

Bound

This column property determines whether the control in a column uses the column's ControlSource or can have its own. Based on our tests, this is one property you shouldn't change, even though you can.

Usage

colColumn.Bound = lBoundToColumn lBoundToColumn = colColumn.Bound
There are actually four possible setups for the ControlSource for a control in a grid column. The simplest is no ControlSource at all, either at the column or the control level. In that case, with Bound set to .T., there's a sort of automatic binding to the appropriate column of the RecordSource. That is, you don't really need to specify a ControlSource for either the column or the control.

If Bound is .T. and there's no ControlSource specified for the Column, you can indicate a ControlSource for the control, despite what it says in Help. (In some early versions of VFP, doing this led to a form that couldn't be opened. You had to go in and edit the SCX directly to fix the form, removing the ControlSource = "" line from the Properties memo field.)

In VFP 3, when Bound is .T., if you specify a ControlSource for the column, it's automatically propagated to the control in the column. You can't change it in the control, though the Property Sheet makes it seem like you can. Later versions don't propagate the ControlSource down to the column, though you can do so yourself without harm.

When Bound is .F., the column's behavior depends on the setting of Sparse and on whether you specify a ControlSource. If Sparse is .F. and no ControlSource is specified, things get really weird. You see nothing in the column until you start typing. After that, the Value propagates between rows. That is, whatever you type in the first row appears in the second row when you get there, and vice versa.

To confuse matters more, if Bound is .F., Sparse is .T. and there's no ControlSource, each cell shows the value of the appropriate column of the appropriate row in the table the grid is based on (despite the lack of binding). But, the value you type still propagates from cell to cell (though it's not stored in the underlying table), making it look like whatever you're typing is simply following you around. Specifying a ControlSource in this case gives you the exact same behavior. We can't see any reason to use either of these combinations of settings.

On the whole, as far as we can tell, you'll never want to set Bound to .F. The results are just too strange.

Example

* Normally, you'll set this up in the Property Sheet. You might * use the following settings in a grid of Employee. The examples * here are meant to be a guide to setting up the grid in the  * Form Designer, not commands to type in. Better yet, just drag * the whole table or the fields you want from the DE. Column1.Bound = .T. Column1.ControlSource = "Employee.Last_Name" Column2.Bound = .T. Column2.ControlSource = "Employee.First_Name"

See Also

Column, ControlSource, Sparse, Value


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net