Because the grid is on crack! (hehehe).
I think it has something to do with the fact that the RecordSource gets recreated. Try setting the RecordSource to blank then recreating the cursor and then reassigning the RecordSource.
Aloha,
James
>Hi everybody,
>
>I put a grid in the container control what I instantiate on the fly on the form. In this grid I set first column to use checkbox, I specified grid's layout, etc.
>
>I left RecordSource for the grid empty and control sources for the columns empty as well.
>
>I have the following code in Init method of the container:
>
>CREATE CURSOR cUsersList (lSelect L, cEmpName C(50), cUserID C(10), cPK C(16))
> INDEX on UPPER(cEmpName) tag cEmpName
> INDEX ON lSelect TAG lSelect
> INSERT INTO cUsersList (cUserID, lSelect, cEmpName, cPK) ;
> SELECT cUserID, .f. as lSelect, cEmpName, cUsgrlink_pk FROM c_AllUsers order by cEmpName
> GO TOP IN cUsersList
> this.grdUsers.RecordSource = 'cUsersList'
> USE IN SELECT('c_AllUsers')
>
>E.g. I try to set RecordSource after the grid is already initialized.
>
>Now, when I first instantiate this container on the form, the grid displayes correctly. But if I remove the container and try to add it again, the nice grid layout and checkboxes are lost.
>
>The question is: why it works the first time and doesn't work the next time during form's life-time? How can I make it to work consistently correctly?
>
>Thanks in advance.