Hi,
I have a form (SCX) with no cursor in its DE. (It opens a table in its load() event)
At runtime, when the form's grid control is being instantiated, that is in grid.Init() method, I notice that THISFORM.DataEnvironment is an object, TYPE('THISFORM.DataEnvironment') = 'O'
I then save that SCX as a class frm_PVCT in a classlib HVCFRM.VCX then runs the form as below:
m.oFrm_PVCT = NEWOBJECT('frm_PVCT', 'HVCFRM.VCX')
m.oFrm_PVCT.SHOW(1)
However, in the grid.Init() method, I notice that THISFORM.DataEnvironment is absent.
I know that because a line in my grid.init():
IF NOT EMPTY(THISFORM.DataEnvironment.InitialSelecteAlias) AND ...
triggers VFP error# 1925, unknown member DATAENVIRONMENT ...
My question are:
1) It is true that, at runtime a SCX always has DataEnvironment established even if it does not has any cursor added to its DE?
2) For a form class, how do I give it an empty DE like that in 1), so that its DE is established early enough to be seen by the form's controls when they are being constructed?