Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object References
Message
From
17/10/1997 09:52:51
 
 
To
16/10/1997 23:50:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00054889
Message ID:
00055147
Views:
24
>>I've been reading through all the threads I can find this morning about releasing object references, and still haven't found an answer to my problem. So, here goes... I have a toolbar with a container that has textboxes in it. The textboxes have properties that contain references to other objects in the container. The container has an array property that has pointers to all objects it contains. I cannot figure out how to get all the object references 'released'. I have tried putting code in the Destroy of the textboxes that sets their previously mentioned properties to .NULL. - I also have code in the Destroy of the container that sets its previously mentioned array property to .F.. In attempting to debug, it appears as though the Destroy event code never fires.
>>I'm still getting GPF's - what else can I do?
>
>
>Hmm, I'm not sure if I understand completely. Have you tried this already? Loop through your array and call the release method of the the object reference you have in the array. Then set the array value to .NULL. or .F.
>
> I've had all kinds of problems and solutions dealing with object references as I use them throughout my code. Plus my framework is codebook so that alone brings alot of object reference uses into play. If you happen to have codebook you could take a look at their code for handling the release of toolbar objects. They seem to make it happen pretty elegantly because I've never had a problem with using controls in a toolbar and I'm just using their stock code with no modifications. In fact I have several toolbars that have textboxes in them for setting the systems process date and displaying the current user. But because the framework is handling all of the initialization and releases I can't really tell you how they do it. Probably the only part of the framework I haven't had to tinker with. :)

Hi Greg,

I too am using Codebook. I started out by simply dropping ctextboxes on a cToolBar and found out that the text boxes were not able to receive focus properly. You could tab (or click) thru them when they first came up, but then you could not back tab (or click) to get back into them once they had lost focus. So, after posting this problem and much debate. I finally took a suggestion from Jim Booth to add code to the textbox controls that will basically force them to receive focus. I then discovered that in order to accomplish this, each control would need references to the 'next' and 'prev' object on the toolbar (or in the container). So....I added code to the container (which held the textboxes and was then dropped onto the ctoolbar) that would store references to all objects it contained and then set the 'onext' and 'oprev' property on each control. I added code to the Destroy method of the textboxes to set it's oNext and oPrev property to .NULL. I also added code to the Destroy method of the container to set the array to .F. (Whew.....)

If I missed something somewhere and the Codebook toolbar class is able to handle this, I would be greatly relieved.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform