Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inconsistent Destroy behaviour.
Message
From
17/09/1999 10:57:27
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Inconsistent Destroy behaviour.
Miscellaneous
Thread ID:
00265929
Message ID:
00265929
Views:
65
I have the following observations/queries - and ultimately, problems.

These both relate to a hierachical structure of Custom objects.

1) During the Destroy of an object, you can reference its parents 'system' properties, but not any user-defined ones e.g.

lcProp = THIS.Parent.Name && This would be OK
lcProp = THIS.Parent.MyCustomProp && Will give an error

2) The value of THIS.Parent.ControlCount during the Destroy of a child object differs depending on how the child object was killed.
i.e.
If the child is being Destroyed because it was RemoveObject-ed from the parent, then the value of THIS.Parent.ControlCount still includes the object being destroyed.

If the child is being Destroyed because another object higher up in the object hierarchy was RemoveObject-ed, and the current object is being subsequently automatically released, then THIS.Parent.ControlCount will already have been decremented to take into acount the removal of THIS object.


The problem for me is that I need to be able to take action if THIS objet is the last child belonging to its immediate parent. The ambiguity mentioned in (2) above makes that impossible. Because of (1) above, I cannot even implement a manually coded alternative.
I could take some action in the parent, when it's last child is removed, but there is no event that always fires at the parent when one of its children is removed. RemoveObject doesn't fire in the second case in (2) above.

Any suggestions greatfully received.
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Next
Reply
Map
View

Click here to load this message in the networking platform