Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to persist a toolbar
Message
 
To
26/10/2002 12:40:08
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00715677
Message ID:
00715768
Views:
14
>>>>Crud. CLEAR ALL still destroys it even if the object ref is a _screen property.
>>>
>>>Which is the reason I posted here :). Even with nodefault and return .f. in the release.
>>>
>>>I'll resort to some way of having the user restart the toolbar manually, until this gets solved.
>>
>>Hi Dragan,
>>
>>I think the cleanest solution would probably be to settle for a custom command for launching this toolbar via the main menu. Main menu changes will persist through a CLEAR ALL, as I recall. I generally would not encourage the routine use of CLEAR ALL, because it's so heavy handed, so my preference is to create custom cleanup logic that is appropriate to each application.
>>
>>The only trick I can think of offhand that might keep the toolbar alive through a CLEAR ALL would be to create a circular reference of the sort that causes those pesky failures to release an object, but this might be tricky to do, and it could result in some sort of flakiness. You know how it is, things never go wrong the way you'd like them to. That would be a violation of Murphy's Law. I haven't tried it, but you might see what happens if the toolbar stores a reference to itself in a custom property.
>
>Nope, dies just the same. I even added a _screen.newobject("mycustom"...), and had this in toolbar.show:
>
this.oRef=_screen.mycustom
>this.oref.obackref=this
>trying to create a circular reference which would make this indestructible. It would probably work if any one of the two tried to .release, but nothing survives Clear All. I could maybe try with a session object which would contain uncommitted changes (those were always hard to kill), but I figure that would be too complicated and way overboard.

Oh well, I didn't think it would be so easy, and even if you could pull it off, there may be some subtle problem with such a kludge. This reminds me, the fact that CLEAR ALL releases member objects added into _screen is not properly documented. It doesn't seem like a generally desirable behavior, and could be regarded as a VFP bug. I think this is a point that should be reviewed by the VFP development staff, or at least corrected in the VFP Help documentation for CLEAR ALL.

Mike
Montage

"Free at last..."
Previous
Reply
Map
View

Click here to load this message in the networking platform