I’m creating my own Drawer window for Cocoa. My basic window (containing no controls) contains several methods and properties to show and hide the window that I’d like to share between instances of the window. As it seems I can’t sub-class a window, is there any other way I can have these methods and properties appear in or be accessible to windows that I’d like to be a Drawer v2?
You cannot subclass a window, but you CAN subclass the Window class. Create a new class in your project and make its Super “Window”. Put your methods and properties in the new class. Then create a new window and set its Super to your class. Voila! It now has all your methods and properties.
w=WindowBD(0)[/quote]
This looks like you’re trying to use WindowBD() like the Window() function. It doesn’t work like that. There is only one Window() function and it returns only the Window type. If that Window happens to be a WindowBD then you can cast it.
[code]dim w As WindowBD
dim temp As Window = Window(0) //get frontmost window
if temp <> nil and temp IsA WindowBD then //if there is a window and it’s a WindowBD
w = WindowBD(temp) //cast it
end
if w <> nil then
//work with w
else
//no windows or the front one isn’t a WindowBD
end[/code]