Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Private DataSession
Message
De
09/07/2002 10:30:57
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, États-Unis
 
 
À
08/07/2002 13:26:21
Sony Joseph
Dovenmuehle Mortgage Inc
Schaumburg, Illinois, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00676186
Message ID:
00676639
Vues:
11
Hi Sony,
Any time you drag an object onto a form, it will participate in the form's datasession. If you want a custom class to have it's own private DS, you have to at some point do This.Property = CREATEOBJECT("MySession") type of coding. I never do a SET DataSession TO in code. I always create the object I want to have a private DS inside a class based on a Form, FormSet, ToolBar, or Session.
Session.PRG
DEFINE CLASS MySession AS Session
   PROCEDURE Create(Class, ClassLib)
      RETURN CREATEOBJECT(m.Class, m.ClassLib)
   ENDPROC  
ENDDEFINE
Create a custom class, MyProcess and give it a Process method.

Create a custom class, VisualPrivateDS.
Give it a oSession property.
Give it a oProcess property.
Give it a Process method too.
Give it a ProcessClass and ProcessClassLib property. Set those to "MyProcess" and "MyProcessVCX".
In the Init of VisualPrivateDS do a
This.oSession = CREATEOBJECT("MySession")
This.oProcess = This.oSession.Create(This.ProcessClass, This.ProcessClassLib)
In the Process method do: This.oProcess.Process()

Now you can drop the class VisualPrivateDS onto a form and the process method will run in it's own DS. (Not that I've tested this code, but I do this sort of thing a lot.)





>Yes. But I won't be able to drag that onto any of my forms. I won't be able to say thisform.mynonVisualclass.process(), instead I have to create the object and call the method. It will work, yes.
Charlie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform