[Mono-osx] Monomac: Issue on Lion when displaying sheets.

Alain alain at slide-effect.com
Mon Apr 2 09:56:13 UTC 2012


Hi,

here follow a short test program that display a small window, and, on close,
displays two popups. The first is the "old school" RunModal() popup, and the
second is the "sheet style" popup.

On Snow Leopard everything works well, but on Lion, the BeginSheet() call
crashes the program without any error or log (RunModal works ok on Lion).

Any idea? It would help me a lot.

Thanks.

Alain Bocherens

------- TEST PROGRAM -------

using System;
using MonoMac.AppKit;
using MonoMac.Foundation;

namespace Test
{	
	public class MainForm
	{
        class TestWindow : NSWindow
		{
			public TestWindow() : base(new
System.Drawing.RectangleF(10,10,500,500),NSWindowStyle.Closable |
NSWindowStyle.Titled |
NSWindowStyle.UnifiedTitleAndToolbar,NSBackingStore.Buffered, false)
			{
				WindowShouldClose += delegate
				{
					NSAlert a = new NSAlert();
					a.InformativeText = "text1";
					a.MessageText = "text2";
					//this one work
					a.RunModal();
					
					//this one not on Lion.
					a.BeginSheet(this,delegate 
					{
						NSApplication.SharedApplication.StopModal();
					});
					NSApplication.SharedApplication.RunModalForWindow(this);
					return true;
				};
				IsVisible = true;
			}
		}
		
		[MonoMac.Foundation.Register("AppDelegate")]
		public class SEApplicationContext : NSApplicationDelegate
		{
			public override void DidFinishLaunching (NSNotification notification)
			{
				new TestWindow();
			}
		}
		
       static void Main(string[] args) 
	    {
			new SEApplicationContext();
			NSApplication.Init ();	
			NSApplication.Main (new string[]{});
        }		
    }
}

--
View this message in context: http://mono.1490590.n4.nabble.com/Monomac-Issue-on-Lion-when-displaying-sheets-tp4525586p4525586.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list