[Mono-osx] Instantiating window with no controller?

Eric J. M. Smith eric at tarkvara.org
Sat Aug 6 18:43:46 EDT 2011


Greetings,

I'm just finding my way in MonoMac, and noticed that one of the template types in MonoDevelop is "Cocoa Window" (as distinct from "Cocoa Window with Controller").  We have some .NET forms that we want to port, and thought "Cocoa Window" would be the thing to use.

But if you have a controllerless nib, how do you actually instantiate it?  I thought the following might work, but myController.Window is always null.

NSWindowController myController = new NSWindowController("MyWindowNib");
MyWindow window = myController.Window;
NSApplication.SharedApplication.RunModalForWindow(window);


From a practical standpoint, it's not a big problem, since we can always use "Cocoa Window with Controller".  I'm just curious how one would actually instantiate a window from nib created using the "Cocoa Window" template.

Thanks,

Eric Smith
Tarkvara Design Inc.


More information about the Mono-osx mailing list