Larry,
So far so good. Maybe I'm a little dumb today. I can't still see why prg couldn't be an option. IOW what can't a prg do that a custom object or form method could do ?
Cetin
>Cetin,
>Objects (unlike PRGs) exist in the datasession that they were created in. If you call a method of that object, VFP internally changes the active datasession and changes it back when the method is over.
>
>The example I talked about deals with more the issue of application-wide objects created in the default datasession and not necessarily objects created on a per form basis. If you create an object that will be used throughout your application but it needs to act on data within a form's datasession then you need to pass the DatasessionID of the form to the method call. The method can then change the datasession to the passed ID, do its thing and change it back before exiting returning control to that which called it.
>
>object method
>lparameters tnSessionID
>THIS.DatasessionHold = set('datasession')
>set datasession to tnSessionID
>* do my stuff here *
>set datasession to THIS.DatasessionHold
>return < somevalue >
>
>form method
>myvalue = osomeobject.mymethod(THIS.DatasessionID)
>
>Doug Hennig uses this technique with SDT. Because the SDT object is created at application startup and it can be used to open tables/views in form's, it needs to know what datasession to act in.
>
>>>>Does that mean that you recommend the 3rd option?
>>>>
>>>>Isn't that taking a step back from OOP?
>>>>
>>>>Kev
>>>
>>>I'm going to respectfully disagree with Cetin here.
>>>
>>>IMO, the time to still use procedure files is when you need to adhere to a particular datasession. However this problem can be eliminated by either passing the datasession to work with or by creating an instance of your object in every datasession (form/session) that will need the functionality.
>>>
>>>As for the form vs. object issue, I would recommend an object. Due to the ever changing world in which we live, you never know when you will need the functionality of this thing in another environment (e.g. web).
>>>
>>>Just my $0.02.
>>
>>Larry,
>>I can't say I could understand. A sample code would be better for me to get it. Thanks.
>>Cetin