>I've noticed one funny thing: I was subclassing a form class which had a grid with, say, 10 columns, and wanted to cut it down at 2-3 columns in form's init. In the debugger, I've seen the columncount go down to 2, but the columns collection still had 10 members, and the refresh fired for all of them.
>
>I suppose you can't possibly release any of the objects defined at the form's class level - I've changed the approach and moved the inherited grid left to -2*grid.width, and addobject()ed another grid just to suit my needs, and it does work. What puzzles me is why did it accept the smaller columncount at all? Specially when it has no effect. Was the debugger simply lying?
That is strange.
Further observances:
oForm = CREATEOBJECT('MyFormWithGrid')
oForm.Grid1.RemoveObject.Column4
?TYPE('oForm.Grid1.Column4')
&& Returns "O"
?oForm.Grid1.Column4.Name
&& Causes an error: Unknown member
?TYPE('oForm.Grid1.Column4.Name')
&& Returns "U"
I suspect you have found a glitch stemming from the way that VFP releases subclassed objects internally: maybe they aren't completely released, but more or less effectively 'hidden'. Looks like the authors didn't completely cover their tracks.
This anomoly could also be related to why the following code sometime causes an error:
THIS.Column3.RemoveObject('text1')
THIS.Column3.Addobject('text1', 'mytextclass')
&& Will in some circumstances cause 'a member with this name already exists'
Erik Moore
Clientelligence