[Mono-osx] How to close a window.

Uli Hertlein uli at xdt.com.au
Mon Dec 19 19:59:14 EST 2011


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


More information about the Mono-osx mailing list