Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Releasing form while references to contols exist
Message
 
 
To
26/06/1998 16:26:56
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00112066
Message ID:
00112174
Views:
18
Bob,

Are you really storing the .Name of the object like:

thisform.pcListBoxName = thisform.lstTheList.Name

or an object reference like:

this.pcListBoxName = thisform.lstTheList

If all you are storing is the name like the first line of code above, it's not what's preventing your form destruction. If you store the name it needs to be converted to an object ref with eval() like you alluded to:

local loObject
loObject = eval( thisform.pcListBoxName )
loObject.Top = loObject.Top - 1


Using the name and converting it to a temporary object ref is sometimes the easiest way of avoiding problems during object destruction. In the highilighting row grid class on my website I do this, just so the grid will not have any destruct sequence problems. The grid just holds the name of the shape it instantiates not an object reference to the shape. It affects performance a little, but I think it's the least worrisome way of doing it.

If you are storing an object reference in the property as the others mentioned this property must be set to .null. (or any other value for that matter) so that the object's internal reference counter will go to zero so the object can indeed destruct.

>I have an object that dynamically creates headers for list boxes. This object is placed on a form, and a property (pcListBoxName) is set to be the name of the list box to manage.
>
>The object also has a property that is an object reference to the same list box (EVAL(pcListBoxName)). My problem is that the form will not release. I think I understand what is happening:
>the form release sees that there is a reference to one of the controls on the form (the list box), and therefore refuses to destroy itself.
>
>I can code around this several ways (like by not keeping that object reference and EVALing everywhere, or specifically calling destroy() of the class with the reference), but it seems like there should be a better way.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform