Hi Markus,
I choose another route. I create class in a code and therefore don't need to mess up with Grid's recordsource. Seems to work fine, though I'm not sure, it's the best code. Also, I have another question: I defined my class as custom. Perhaps I should use Line istead? Which class has the minimal overhead?
DEFINE CLASS Stats AS custom
Name = "Stats"
PROCEDURE Init
lparameters funcid_arg, cmdrob_arg, infile_arg, outfil_arg, param1, param2, param3
do CREATEPRIVATEDATASESSION with "oStatsData"
set datasession to oStatsData.datasessionid
llReturn=RunConfig(funcid_arg, cmdrob_arg, infile_arg, outfil_arg, param1, param2, param3)
if vartype(oJC)='O'
oJC.CurAppStat=iif(llReturn,'C','I')
endif
ENDPROC
ENDDEFINE
>Hi Nadya
>
>Glad it worked, even if only partialy. ;(
>
>I see your problem. Of course you can do this detach/attach of grid controls in this single case from "outside" but definately the better solution would be to define those two methods genericaly in the grids base class. But this needs of course to be discussed in a multi-programmer environment.
>
>To do it on your own, define one array per grid, scan through the columns collection of the grid (this is rather an array) and store the controlSource values in your arrays. Set the ControlSources to "" afterwards, and restore them when done the reverse way. Another problem occurs, when the controls in the columns hold their own Controlsources, that you would have to check also.
>Instead of using external arrays to save the controlSources values you can also use the objects tag or control properties, if they are still unused.
>
>HTH
>Markus
If it's not broken, fix it until it is.
My Blog