Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any secrets to REMOVEOBJECT and C5 Errors?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00821999
Message ID:
00822211
Views:
15
Hi Terry,

Glad to see you have a solution to your problem.

BTW, we are setting AUTOYIELD to .F. in all of our top level forms that have containers with any OCX objects on them. I have been experimenting with using the default (.T.) and as yet haven't found any differencs in performance

Have a good one,

Tom


>We should have titled this thread Anatomy of a C5 Error:-)
>
>Your initial reply had me look at the problem. As I experimented with the objects, I moved ALL the container stuff to the parent class, so it was ready when the subclass (or show()ed) form was CREATED. Speedier!
>
>I isolated the issue, so my faith in VFP's reliability is still strong. I can understand VFP not wanting to get involved in whether or not the container passed was a form or a container.
>.
>* The action that opened the popup mis-represented the form reference
>OpenpopScheduleItem(20,20,this.parent.parent,this.parent,val(this.parent.lblItemNo.caption))
>* Note: the second parameter "this.parent.parent", referenced BigContainer,
>* and not the form
>
>* A messagebox trap revealed [that] what I thought was a form reference,
>* was (in reality) a container reference. So, I added the third inheritor
>* (parent),and it worked as advertised.
>
>OpenpopScheduleItem(20,20,this.parent.parent.parent,;
>    this.parent,val(this.parent.lblItemNo.caption))
>* Note: the second parameter "this.parent.parent.parent"
>
>
>I was ready to set the containers to NULL and forget about them, and - at the last moment - my "logic error" became apparent. Go figure!
>
>Thanks for kicking some ideas around. Regarding AUTOYIELD - I feel the same way - I'd rather leave it at default. When it is set on, it sems to slow things down.
>
>Another thing I did, and it may be related to some of the C5 stuff, was NOT removing focus from the container about to be RemoveObject[ed]. What I did was add an unseen (but not invisible) dumb textbox that I could programatically click to assure focus was removed from the container the app was about to remove. I can understand VFP having issues with "removing" active objects. Maybe that has a relation to some of the C5's you experienced.
>
>Again Thanks - Now to see what other kinds of trouble I can stir up - it looks like I'll get to bed before 3am tonight:-)
>
>
>>Hi Terry,
>>
>>We add containers that contain treelist and listview objects to our top level forms via Createobject in code.
>>
>>We remove them prior to destroying the forms and it seems to work ok. We are not setting autoyield to false, at least not that I can find.
>>
>>We are using VFP 7 SP1 so I don't know if that matters.
>>
>>The more that I think about this, we were getting the C5 errors under certain conditions. I think it had to do with adding more objects to the container and then not removing them first before the container itself was removed.
>>
>>I will try to dig around some more on this.
>>
>>Sorry could not be of much help now.
>>
>>
>>>Thanks for the reply - the project is a PRG. No design time issues.
>>>
>>>
>>>*form from create object.
>>>
>>>oform.addobject('oBigContainer','subBigContainer')
>>>
>>>*The add is inside a loop.
>>>
>>>for c = 1 to numberofcontainers
>>>lcLittleContainerName='cnt'+right(str(c+100,3),2)
>>>oform.oBigContainer.addobject(lcLittleContainerName,'subLittleContainer')
>>>loLittleContainer=eval([oBigContainer.]+lcLittleContainerName)
>>>loLittleContainer.top=(c-1)*90
>>>... etc ...
>>>endfor
>>>
>>>*remove looks like:
>>>oform.oBigContainer.RemoveObject(lcLittleContainerName)
>>>
>>>When I activate the command window and do it from there - works. Only fails inside the PRG. I am checking to see if changing sequence of the remove instruction has an affect. Also - the sliders are OCX - so I will need to see if an AutoYield offers some hope!
>>>
>>>Do you think I should add the containers in the form's parent class before it [the form] is subclassed via CREATEOBJECT?
>>>
>>>>Just for curiosity did you use ADDOBJECT to add the container to the form or was it added at design time?
>>>>
>>>>>This project has a form, with a container (that contains smaller containers).Sliders move the big container around in the form (have set autoyield).
>>>>>
>>>>>When a process removes a "liitle" container inside the "big" container inside the program:
>>>>>
oForm.oBigContainer.RemoveObject("oLittleContainer")
>>>>>VFP crashes. When I remove the object from the command window while the form is running, it works okay! BTW: oLittleContainer contains some textboxes.
>>>>>
>>>>>It does the same in both 6 and 7. I lieu of a secret workaround I could just INVISIBLE the discarded container (and rename it).
>>>>>
>>>>>Thanks
Tom

Life happens, don't blink.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform