Hi!
I will use this code in my base grid!
Thanks.
Sarosh
>Hi!
>
>"In the grdCustomer's AfterRowColChange Event I have tried calling the cursoradapter's CursorRefresh() and CursorFill() -ThisForm.DataEnvironment.cadOrders.CursorRefresh()/CursorFill() methods and the grid looses all its column settings because a new underlying cursor gets created each time I call CursorRefresh() or CursorFill()."
>
>I've had the same problem some time ago - which VFP developer hasn't stumbled across this one yet?! :)
>
>"Other than saving the grids columns settings .."
>
>That's the best option IMHO and it isn't that complicated at all.
>One also doesn't have to save all options. The only thing the following code does is to ensure that the current columns don't loose their settings in the first place.
>
>the code from my grid-baseclass:
>
>
>FUNCTION Grid::Init()
> LOCAL loCol
> THIS.AddProperty('OriginalRecordSource',THIS.RecordSource)
> FOR EACH loCol IN THIS.Columns
> loCol.AddProperty('OriginalControlSource',loCol.ControlSource)
> ENDFOR
>ENDFUNC
>
>FUNCTION Grid::Lock()
>LOCAL loCol
>THIS.RecordSource = ""
>FOR EACH loCol IN THIS.Columns
> loCol.ControlSource = ""
>ENDFOR
>ENDFUNC
>
>FUNCTION Grid::Unlock()
>LOCAL loCol
>THIS.RecordSource = THIS.OriginalRecordSource
>FOR EACH loCol IN THIS.Columns
> loCol.ControlSource = loCol.OriginalControlSource
>ENDFOR
>ENDFUNC
>
>
>usage is quite simple, just call the grid's Lock() method before you're
>rebuilding it's underlying cursor (what code is used to rebuild the cursor doesn't matter) and Unlock() afterwards.
>
>Regards
>Christian