Recovery
System
       
Subsystem
list
       
Top
level


The RECunwantedWindows Class

This recovery class handles the closing of windows that aren't needed. The base state is defined to be the absence of unwanted windows; the list of unwanted windows is derived from a RECapplication object.

Declarations

winclass RECunwantedWindows : RECbase;
window RECunwantedWindows grRECunwantedWindows;

Overridden Methods

boolean IsHappy (RECphase ePhase, boolean logFirstFailure)
boolean BeHappy (RECphase ePhase)


IsHappy

Returns TRUE if there are no unwanted windows currently open. For more information, see RECbase.IsHappy.


BeHappy

Closes any unwanted windows. For more information, see RECbase.BeHappy.


Implementation Notes

This is one of the less obvious parts of the Recovery System, and as such deserves some explanation.

The obvious way to get rid of unwanted windows is to call the built-in 4Test method MainWin.GetCloseWindows which, contrary to its name, returns a list of all the currently open windows in the application. However, GetCloseWindows has a fatal flaw. If you dynamically instantiate a window using a user-defined class, the corresponding window returned by GetCloseWindows will not be of the user-defined class, but of the built-in 4Test class from which the user-defined class was derived. Thus, for such a window, a recovery system based on GetCloseWindows does not have access to any overridden methods. If you have to override the Close method (as we do for many windows in the Media Composer), you're screwed. To make matters worse, if you have two dynamically instantiated windows of different classes, but with the same caption, you won't be able to tell one from the other, using the windows returned by GetCloseWindows.

The best solution seems to be to use an extension function in the application to return a list of currently open windows. Unfortunately, 4Test does not allow windows to be passing to or returned from extension functions. Therefore, we use a string (RECwindowUid) to represent a window. Encoded in the string is the class of the window and its title, which we can use to unambiguously identify a window.



This page is maintained by (REMOVED).
Last updated 8 March 1999.