[Mono-osx] How to close a window.

Chris Waldron chris.waldron at booktrack.co
Tue Dec 20 05:30:41 EST 2011


I'm closing the window from the window class so I'm using this.  What I
noticed is that it crashes if you used null but it doesn't crash if you use
new NSNull().  I think there are still funky conversion issue because IMO
null should be implicitly converted to NSNull and likewise string to
NSString.  However I've run into several inconsistencies.

On Tue, Dec 20, 2011 at 1:59 PM, Uli Hertlein <uli at xdt.com.au> wrote:

> Hi Chris,
>
> On 20/12/2011 11:52, Chris Waldron wrote:
> > I just submitted a question to close down a window and Uli description
> > of his issue help me resolve my issue.  The OrderOut method closes the
> > window.
>
> Did you by any chance manage to call it with sender==null?  This is what
> I've found in various Cocoa tutorials but it crashes in MonoMac
> (NullReferenceException) - not a big deal but I was wondering if it's
> obsolete data on the Internet or MonoMac-specific.
>
> (Unfortunately I haven't had any luck with my issue so far).
>
> Cheers,
> /uli
>
> > On Mon, Dec 19, 2011 at 3:05 PM, Uli Hertlein <uli at xdt.com.au
> > <mailto:uli at xdt.com.au>> wrote:
> >
> >     Hi guys,
> >
> >     this might be more of a pure Cocoa question than anything, but since
> I'm
> >     writing this in C#/MonoMac it applies here as well and I'm hoping for
> >     some expert insight.
> >
> >     I have a MainWindowController (with an NSWindow from .xib) and a
> >     EditWindowController (with an NSPanel from another .xib) that's
> supposed
> >     to slide over the main window as a sheet/modal dialog.
> >
> >     To begin/show the edit sheet I'm calling:
> >
> >       NSApplication.SharedApplication.BeginSheet(editPanelWindow,
> >     mainDocWindow, selector, 0);
> >
> >     and close it with:
> >       editPanelWindow.OrderOut(sender);
> >       NSApplication.SharedApplication.EndSheet(editPanelWindow,
> returnCode);
> >
> >     where editPanelWindow is the NSPanel and mainDocWindow is the main
> >     window.
> >
> >     The first time the editPanelWindow pops-up almost randomly on the
> >     screen, not attached to the mainWindow.  Oddly enough after closing
> and
> >     re-opening the NSPanel it nicely slides out of the mainWindow title
> bar
> >     and is in the right location.
> >
> >     It feels like there's some setup taking place as part of the
> >     BeginSheet/EndSheet that I'm missing but the docs/tutorials/etc
> aren't
> >     helpful...
> >
> >     Cheers,
> >     /uli
> _______________________________________________
> 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/20111220/86e74677/attachment.html 


More information about the Mono-osx mailing list