At 3:46 PM -0700 4/20/06, Keith DeLong wrote:

I'm trying to close a certain Window without knowing if it is open. Of
course w.close instantiates the window if it doesn't exist.

Well, only if "w" is the name of a window class -- not if it's a window reference.

I'd like a generalized function where I could pass any window class and
close it if it is open.

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?

Best,
- Joe

--

Joe Strout  --  [EMAIL PROTECTED]
Available for custom REALbasic programming and training.
_______________________________________________
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>

Reply via email to