[Mono-osx] (no subject)

David Black David.Black at casewise.com
Wed Feb 15 15:28:20 UTC 2012


Hi Virgis

The actual solution was for me to remember the last change I made yesterday. My window was derived from NSPanel not NSWindow, so while it was key, the main window was still the same. So the close message went to the main window not the pop-up. When I changed to derive from NSWindow Close() now works as expected.


Thanks for your help.

D




From: Virginijus [mailto:mrgutis at gmail.com]
Sent: 15 February 2012 14:09
To: David Black
Cc: mono-osx at lists.ximian.com
Subject: Re: [Mono-osx] (no subject)

Hey,

  You are closing you "pop-up" window incorrectly. Close method sends close signal to program. So to close your window you should use code:

NSApplication.SharedApplication.Stop(this);

this.OrderOut (this);
I am assuming this code will be put into you "pop-up" window class and called upon cancel button press.

Regards,
Virgis
On Wed, Feb 15, 2012 at 3:53 PM, David Black <David.Black at casewise.com<mailto:David.Black at casewise.com>> wrote:

Hi All

I've been experimenting with monomac for a short while and I've come across a strange issue. My app has a (so far) empty main Window and a menu option that opens a non-modal window for data input. In the cancel button action I call the Close method on the window controller for the pop-up Window

This closes my pop-up and leaves the main window in place (as expected).

In my app delegate I added the following

public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
{
                return true;
}

Now when I close the pop-up window, even though the main Window is still visible, the app quits. This is not what I expected as the main window is still there.

Is this expected behaviour? Or is it because I have no content in the main Window or actions or Outlets and the GC is freeing the window even though it's still visible?

Colour me confused :)

David.

_______________________________________________
Mono-osx mailing list
Mono-osx at lists.ximian.com<mailto: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/20120215/69834c8e/attachment-0001.html>


More information about the Mono-osx mailing list