Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 5.0: Where to put code scoped to current datasession
Message
From
22/09/1997 11:46:47
Alejandro Morilla
Benefit Administration Corp.
Fresno, California, United States
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00051041
Message ID:
00051042
Views:
32
>I received this message via e-mail on 9/18/97 and was wondering if someone had responded.
>
>
>Tim Westmoreland
>The Ashley Companies
>twestm@tsixroads.com
>
>******************************************************************************************************************************************
>
>Hi all,
>nowhere in the VFP docs can I find an answer to the following problem:
>The forms I use in my app have all private datasessions.
>But many Set commands (like set deleted or set exact) are scoped to the current
>datasession.
>Therefor it is no use to do these set commands once at the beginning of my app.
>
>
>I would like to put these set commands into my base class for forms. But I
>can't find how. The earliest event for a form is the Load-event, however the
>BeforeOpenTables Event of the Dataenvironment runs before the load of a form.
>Now, there seems to be NO DATAENVIRONMENT for a form CLASS. Does that mean, I
>have to put my set commands in every Dataenvironment of all my forms, even so
>it is always the same code and all forms are based on the same class? Does not
>seem very object oriented to me...
>How can I avoid this?
>
>TIA, Peter (Peter.Mair@cp.novartis.com)



This is how I solved that problem:
If you look at the Tastrade sample, they create a 'Custom Class' call 'Environment' which you can use as
an example to create a similar one (I called it 'FormEnvironment'). Then from the Init event of your Class
form you can type the following code:

*-- Set the environment
.AddObject("oFormEnvironment", "FormEnvironment")
.oFormEnvironment.Set()

That should take care of that problem.
Previous
Reply
Map
View

Click here to load this message in the networking platform