Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passive Observers
Message
 
To
04/01/1999 09:41:42
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00171144
Message ID:
00172636
Views:
25
Steve,

>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. >

Actually, when the SetAll method is issued at the form level, it *does* filter down to *all* objects on the form...even those in containers.

I'll describe a scenario in which I use this feature that is somewhat similar to your own:

In our Mere Mortals Framework, I have implemented the "Trace-Aware" feature in our base timer class. As I'm sure you know, the "Trace-Aware" feature allows a timer to be automatically shut down whenever a Debug/Trace window becomes active. However, this is only half the battle...how do you restart the timers when you have finished debugging?

We solved this problem by adding a Timer Manager to the Framework. When a timer instantiates, it automatically registers itself with the Timer Manager which in turn saves a reference to the timer object in its collection. This allows you to send a single message to the application's Timer Manager to reset all active timers.

But now a problem arises when a timer is located on a form. The form will not release if a reference to the timer is stored in the timer manager. The reference must be released before the form is destroyed. This is where the "raising events" functionality comes into play.

In our base form class's Destroy method, we have the following code:

This.SetAll('lDestroy', .T.)

This command in effect raises a "Destroy" event. Our timer class has an "lDestroy" property and a corresponding "lDestroy_Assign" method. No matter where the timer is located...whether it's on a page in a pageframe, or inside of a container, its lDestroy_Assign method gets fired...which contains code to Unregister the timer with the timer manager.

This method is much faster because it's using a built-in VFP command (C++ code) to do the work rather than using VFP code to iterate through all objects on a form.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform