Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Smallest object in VFP 7
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00590364
Message ID:
00591926
Views:
31
>>>>>Jim
>>>>>How do I set up and save a class based on Session in a Class library. "Session" is not available on the drop down - but is in DEFINE CLASS....
>>>>
>>>>David,
>>>>
>>>>You don't, you use DEFINE CLASS in a prg.
>>>
>>>Jim, can I give you a simple non-real example of what I would like to do?
>>>Lets say I have an addressing module and it does all sorts of neat things with addresses. It also uses an "Address" table which I wan't to be in a private data session belonging to the class.
>>>I would then want to be able to write, for example, a method called exists..
>>>function exists
>>>lparameter nAddrnum
>>>return indexseek(m.nAddrNum, 'Address', 'Addrnum')

>>>
>>>In my main program I would have:
>>>private oAdr
>>>oAdr= NewObject('Address', ....)

>>>
>>>Where, how, would you suggest I incorporate a "session" so that this object, which persists for almost the entire application, has it's own "hidden" use of the "address" table? Assume oAdr is currently based on a custom class.
>>
>>
>>Maybe in the init of the address object you have to create an instance of a session, assign the appropriate properties, and bind it to a property of the Address object.
>
>Then the data session of the object will still be the default data session, since that is where it was created. I wan't to be so that whenever a method is run in the object it refers to its own datasession, like a form.

If your up for a little VCX hacking, you can create an object of a VCX as a Session.
CREATE CLASSLIB Tester
CREATE CLASS oSession OF Tester AS Form
USE Tester.vcx
BROW
Now goto the line for oSession, can use the ObjName field to find it,
change 'class' and 'baseclass' to session (instead of form) and there you have it, a Session stored in a VCX.
There is however no visual editor for a session, and you need to maintain the properties etc by directly editing the VCX
Previous
Reply
Map
View

Click here to load this message in the networking platform