Hi David,
ActiveRow property of the grid is not reliable, e.g. you can not base your highlighting on it. Use recno(this.recordsource) instead...
Yes, the idea of data-driven grid is pretty neat. My colleague and I use this technique in several applications. I also added ability to show ToolTiptexts and StatusBar text for grid's headers using technique described by Vlad Grynchyshyn (e.g. I have a special grid class) and I use my own Header class, which allows sorting by clicking on the Header...
>I was playing around with a grid and ended up adding the following to it:
>
>thisform.grid1.setall('dynamicbackcolor', 'iif(thisform.grid1.activerow = thisform.grid1.activerow, rgb[0,64,128], rgb[255,255,255])', 'column')
>
>thisform.grid1.setall('dynamicforecolor', 'iif(thisform.grid1.activerow = thisform.grid1.activerow, rgb[255,255,255], rgb[0,0,0])', 'column')
>
>This did the highlighting the way I wanted pretty well, although sometimes the grid would momentary display all rows highlighted - something I'm sure could be fixed (if your picky like me).
>
>Thanks for your code! I build most of my grids at runtime using a table. The table stores the property names and values for the grid. At runtime the table is scanned and using macro substitution the properties are defined for the grid. This way, at runtime, the user can go into a setup screen and change the properties for their grid to suite their needs and it instantly changes the appearance of grid. And being the data is in a table their settings will stay that way until they decide to change it again.
> Also, in runtime, if the record source for a grid needs to be requeryed or the record source name is changed the grid will do crazy things such as redefine column widths and header captions. But running the grid from this table can instantly put the grid back to the way it was.
> If I need to add code to objects that are within the grid I class them ahead of time and then use the AddObject method in the table.
> This works really good,... if you want I can send it to you.
>
>Thanks again for your help!
If it's not broken, fix it until it is.
My Blog