Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Destroy event does not fire when form is released
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00582372
Message ID:
00594509
Views:
44
Andrus,

You're probably way past this by now but I realized I never replied.

>I thought that in VFP 7 all of those probles are fixed.
>Where are such problems described ?

It isn't a problem; it's simply the difference between AddObject() and CreateObject(). AddObject() creates containership and CreateObject() doesn't. Without containership you cannot depend on objects to be released properly and must be handled in code.

>Using addobject() instead of createobject() in the sample code causes error
>object class is invalid for this type of container
>so I cannot use it.

Yes, that is a problem. If session classes could contain session classes my programming life would be much cleaner. But that isn't the case... In my opinion it would be the best improvement for building process, business and data objects the VFP could make. I use a toolbar class as my base business and process classes and custom class as my base data object class because the toolbar class is a valid container for custom classes and handles properly releasing all my data object classes without me having to handle it.

My problem occurs because a toolbar class cannot contain a toolbar class. An example I have is a process class which instantiates a business class in order to do batch processing. The business class handles the updating of all effected data such as a dock transaction that must deduct from another transaction and also deduct from the employee's time bank or a vacation transaction which only effects the employee's time bank. If there isn't enough to deduct from either place the transaction fails. The process class generates standard transactions for a pay period and any recurring transactions defined by payroll. So the process class has it's own data objects which provide the batch information and a business object which it interacts with to create the actual transactions. I use CreateObject() to instantiate the business object from the process object and manually handle releasing the business object because the process object does NOT contain it. Else the process object is not properly released.

A long explanation but this has been my experience. Manually handle releasing any object references instantiated with CreateObject().

Will
Heavy Metal Pedal - click with care
Previous
Reply
Map
View

Click here to load this message in the networking platform