Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passive Observers
Message
From
04/01/1999 09:41:42
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00171144
Message ID:
00172388
Views:
28
>>>I don't know of a clean way to implement raising events in VFP 5 without adding too much overhead. For this particular problem, in VFP5 you could do something that isn't quite as elegant by adding an additional observer object to the form itself. Basically, a subscriber would register itself with the form-level observer AND the application-level observer. When the form is Destroyed, it can send a corresponding message to all registered observers.
>
>>Ok. But in answer to Steve's question. Where would you un-subscribe if you were using VFP 5.0 instead of VFP 6.0.
>
>In the scenario I described, when a subscriber receives a message from the form indicating that it is being destroyed it can unsubscribe at that point.
>
>Regards,

Thanks to all,

I guess my original solution is still the one I'll use. The SETALL method will only get objects that are direct children of the form, if there are objects inside containers they won't get the message. I wrote a recursive procedure to fire a specified method of every control within a passed object reference. I added a property lUnSubscribeObjects to my form class and put code in the QueryUnload to use my procedure to run the UnSubscribe method of all contained objects when the lUnSubscribeObjects flag is TRUE.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform