>> I'd like a generalized function where I could pass any window class and >> close it if it is open.
Joe Strout wrote: > But you can't, since you can't pass a class. The closest I can > imagine is to define a subclass of Window, that defines a method for > returning a class identifier. You'd make all your windows a subclass > of that, and override this method in each subclass to return a unique > identifier. Then, you could pass such an identifier value into your > function, which would crawl the window list, typecast each window to > that base Window subclass, and use the identifier method to see if > it's something you want to close. > > All seems like a lot of fuss to me, though. I'm curious, why do you > need a function to close windows of a given class, without even > having any references to them? Example 1: myWindow is set as the default window on launch. The user may or may not have closed this window. I now want to close myWindow if it is open. Example 2: I tend to use myWindow.open employing auto instantiation quite often for windows like preferences. I got into this early on habit as it prevents multiple copies of the window from being open should the user bury lose the window and select Preferences menuitem a second time. Occasionally I want to close one of these types of windows are non modal and I don't have a reference to it. Are you suggesting I've just been lazy and should be tracking references to all windows as they open and close? ;-) Keith _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
