>>With this technique, the grid's visual characteristics are maintained, but the ControlSource for EVERY GRID COLUMN is reset as described above. The same thing happens if I set Bound to False and work with the ControlSource in the grid cell rather than the grid column.
Tom suggests:
>If the COLUMN control source is set to Table.Fieldname you should be ok. Works for me.
Keep in mind I'm working with a view mapped into a grid, if that makes any difference vs a table mapped into a grid. I tried your suggestion in this context: Grid's column controlsource set as you suggest. Grid's RecordSource blank at time grid is instantiated. I programmatically set RecordSource, and the ControlSource for all columns is reset at that moment to match the physical order of all fields in the view. Same thing happens when I use FormDesigner to initialize the grid's RecordSource and then try to change it programmatically.
However, I did realize something regarding that trick about setting RecordSource to an empty string, and then resetting it to something meaningful: the "something meaningful" is supposed to be an alias for an SQL cursor, not a view. In my experience, this keeps the grid from losing all its formatting characteristics when the SQL cursor is destroyed and rebuilt by re-executing the SQL statement.
For a view, there is apparently some logic internal to VFP. A grid based on a view is "view-aware", so that resetting the RecordSource is not necessary and in fact, is harmful. All I needed to do (I think) is just do a Requery() without modifying RecordSource, then maybe follow with a Grid.Refresh().
Comments? Confirmations? Thanks!
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement