[Mono-osx] NIB files in non-executable assemby problem

Virginijus mrgutis at gmail.com
Thu Feb 9 20:12:40 UTC 2012


Make sure your windowcontroller has:

*//strongly typed window accessor*

* public new <WindowClass> Window {*

*  get { return (<WindowClass>)base.Window; }*

* }*

On Thu, Feb 9, 2012 at 7:32 PM, Chris Hamons <chris.hamons at ni.com> wrote:

> I'm working with monomac and am trying to port some code. I'm unsure if
> this is a problem with my code, with my project build settings, or an
> actual bug. Any help would be appreciated:
>
> I have two assemblies of interest, one setup as a Library and the other as
> an Executable (that depends on the Library). The code in question is
> roughly:
>
> Executable Assembly:
>
>         static void Main (string [] args)
>         {
>             MyApplication.Run();
>         }
>
> Library Assembly:
>
>         (MyApplication)
>         public static void Run()
>         {
>             try
>             {
>                 NSApplication.Init ();
>                 NSApplication.Main(new string[] {});
>             }
>             catch (Exception exception)
>             {
>             }
>         }
>
>
>        (AppDelegate)
>        public override void FinishedLaunching (NSObject notification)
>        {
>              mainWindowController = new MyController();
>              mainWindowController.Window.MakeKeyAndOrderFront(this);
>       }
>
>
>         // Call to load from the XIB/NIB file
>         public MyController() : base ("MyController")
>         {
>             Initialize ();
>         }
>
>
> The Library Assembly also contains MyController.xib.
>
>
> If I run the project as listed, mainWindowController.Window is null (and
> thus I crash) and in some conditions I get a print to Application Output
> about difficulty finding the xib file.
>
> If I add a reference to MyController.xib in my executable assembly then I
> see my window just fine.
>
> Is there any way I can make this work without having to add this
> reference? I've tried changing the build setting in MyController.xib in the
> Library assembly to no effect.
>
> If my example is unclear, I can create a simple project that shows this if
> necessary.
>
> Thanks,
> --Chris
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20120209/a522b39e/attachment.html>


More information about the Mono-osx mailing list