[Mono-osx] How to close a window.

Chris Waldron chris.waldron at booktrack.co
Mon Dec 19 19:52:36 EST 2011

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.


On Mon, Dec 19, 2011 at 3:05 PM, Uli Hertlein <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/83049977/attachment-0001.html 

More information about the Mono-osx mailing list