I have a grid with no columns - they were added programmatically in the grid's .init, using code like this:
this.Newobject("colRsd_itemno","column")
This has worked without a hitch at runtime. Then I decided I can't maintain the widths manually forever, and decided to apply this same code to the grid once at design time. I've copied the code into a temp.prg, aselect()ed the grid and passed it as a parameter to a little prg, which looked like this
Lparameters o
With o
.Newobject("colRsd_itemno","column")
The error I got sounds like a very wrong error:
You may not change the RecordSource of a BROWSE object.
(Error 1772)
The browse object must remain aligned with its table.
You tried to change the RecordSource property programmatically.
To browse a different table, close the current browse and browse the new table. For more information, see BROWSE or RecordSource. It persisted even when I tried it on a completely blank grid with no recordsource at all. I had to tweak the code to
Lparameters o
With o
.columncount=8
.columns[1].name="colRsd_itemno"
to get it to work, and it worked perfectly then.
So I'm puzzled - why would .newobject({name}, "column") be OK at runtime, and bang with such a silly error code at design time.