Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Class object cannot see private datasession?
Message
De
14/01/2000 13:33:19
 
 
À
14/01/2000 09:02:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00317802
Message ID:
00318238
Vues:
21
>Default datasession works, and I can use default here, but I still don't understand something. I want to use all my oApp methods all over the app, from any form, and it worries me that an oApp.customclass.method() can't see a form's datasession when the form calls it.
>
>IOW, I have a number of custom objects created with oApp object in Main.prg. Is it correct that, since an oApp.X_mgr class isn't instantiated in the form container, the oApp.X_mgr.method() should not see the form's private datasession?

That is correct. It should only see the datasession it was created it, but nothing prevents you from changing to a different datasession.

>Does this mean that one should avoid using Private datasessions when using global oApp PEMs instantiated in Main.prg?

No, it just means your object has to be aware of what datasession it wants to use. It can either handle that itself (SET DATASESSION TO _SCREEN.ActiveForm.DataSessionID), or the calling object must pass it's DataSessionID to your object.

Just a word of caution, if you do change the datasession within the object, be sure to put it back where you found it before you return, otherwise you will have changed that object's datasession for all future calls, too. Not putting it back may also create some strange "dangling object" references, too.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform