Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox in grid
Message
From
08/01/2003 06:12:58
 
 
To
07/01/2003 12:13:51
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00738867
Message ID:
00739223
Views:
16
Hi Peter.

>I have a combobox in a column within a grid. It is bound to a field that contains a 2-character code. This code, in turn, is defined in another table that includes both the code and a description for each code. RowSourceType is set to 3 (SQL Statement) and RowSource is "select description, code from codetable into cursor tempcode". BoundColumn is 2, indicating the code field from the SQL statement.
>
>In the grid, this column displays the code values to be found in all of the records displayed in the grid, except for the currently selected row, where the description value is displayed.
>
>Is there any way to have the description displayed on *all* of the rows, and not just the currently selected row?

Or, if you do not want to set the column's sparse property to false (personally, I think this makes the grid look cluttered and busy), here is an alternative, but it takes a little more work. Also, this will only work if you are using a drop down list in the grid (style = 2) and will not work if it is a drop down combo (style = 0).

Set up the grid column with the drop down list like this:
Bound = .F.
ControlSource = IIF( SEEK( < GridRecordSource.CodeField > , 'CodeTable', 'CodeIdx' ), CodeTable.Description, '' )
Then you can set up the drop down list as you have described and set its ControlSource to the field the the grid's RecordSOurce that you want to update.

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
Next
Reply
Map
View

Click here to load this message in the networking platform