Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Factory Objects - practical application
Message
From
17/12/2006 21:27:08
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
17/12/2006 18:40:10
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01177742
Message ID:
01178462
Views:
27
>I don't even think that matters. If an object changes it's datasession via SET DATASESSION, other objects or a form isn't affected at all. They all live in their own session. Or do you experience any problems with two forms each non modal and each with their own private datasession?
>
>You might cause problems when changing the session of a form or of objects belonging to a form (added by AddObject), but changing goApp's session will not cause any trouble. In that respect all works as for the session class, when code runs in a class it works in it's active session. That's why instead of a session ID parameter of some methods a general setDatasession() method is also a good way to set the session and then run any method in that session, eg.
>
>
>goApp.setDatasession(set("datasession"))
>goApp.oData.getSomeData()...
>goApp.resetDatasession()
>
Agree on all counts. The trouble was only between the global objects, which live in the DS 1, and the other objects, which belong to other DSes but call methods of global objects. And passing the DS number as in your example is the sure-fire way to make it work. I've seen a few frameworks which operate like that.

I generally don't have trouble between forms, because each form uses its own DS, and if I have to pass some data between them, I pass a parameter object - so there's no mix of form1's code calling code from form2, they only pass parameters; form2's code runs inside form2. It's just the way I organize my code, not a firm rule, but come to think of it, it should be a rule :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform