Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why is there a ControlSource for Column and Control?
Message
From
05/02/2008 10:50:27
 
 
To
05/02/2008 08:40:10
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01289477
Message ID:
01289553
Views:
13
I'm having trouble displaying a CheckBox in a grid and in the course of trying to find the issue, I see that there is a ControlSource for the MyGrid.MyColumn and the MyGrid.MyColumn.MyControl. Why? When should either one be used?

Just to add to what Dragan said, I set them up differently when using a combo box in a grid. This excerpt from chapter 1 of MegaFix explains why:

Typically, the purpose of using a combo in a grid is to bind the column to some foreign key value in the grid’s RecordSource while displaying the associated descriptive text from a lookup table. This means that when the column’s Sparse property is left at its default value of false, all rows except the current one display the foreign key value instead of the descriptive text. In order to get around this problem in the sample form, we set the Bound property of the grid column named ‘iColClientFK’ to false and its ControlSource to ( IIF( SEEK( Contacts.iClientFK, 'Clients', 'iClientPK' ), Clients.cCompany, '' ) ). Now the client name is displayed in all rows of the grid.

At this point you are probably saying to yourself “Hang on, there! Setting up the column’s ControlSource like that has the side effect of making the column ReadOnly!” and you would, in fact, be correct. However, when you run the example, you will see that you can still drop the list and make changes to the client for the current contact. The reason for this is that the ReadOnly attribute applies only to the portion of a control that accepts text. Since a drop down list does not accept text, it cannot be made read only (any more than a command button could be made read only). Fortunately, this behavior is documented and is by design so it is unlikely to change in future releases of the product.
Previous
Reply
Map
View

Click here to load this message in the networking platform