On Apr 20, 2006, at 5:46 PM, Keith DeLong wrote:

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

  Function CloseWindow (W as Window)
     For i as integer = (WindowCount-1) downto 0
      if Window(i) isa W then Window(i).close
    Next
  End Function

The problem above is the compiler complains that w is not a class.

That's correct. W is not a class it's a window of a certain class which is unknown. The isA function takes a class not an object which would be of some class type. You could use another parameter of the window to distinguish them. Are the Titles unique per class of window? If not, you may need to add a property to your windows and use that, or you can use a big case statement where you determine the class exhaustively. AFAIK RB doesn't have introspection, I think that's the term, where an object could tell you about itself in the way you would need for your idea.

HTH,
Kevin
_______________________________________________
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