Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form class and its DataEnvironment
Message
 
 
To
15/07/2011 17:52:59
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01518316
Message ID:
01518318
Views:
58
>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?

Form classes don't have DE. For them you need to open related data in the Load event.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform