[Mono-osx] Create window at runtime

De Santis Luca farolfo at hotmail.com
Thu Feb 2 21:25:17 UTC 2012


I've try with this code but with this simple class:
using System;using System.Drawing;using MonoMac.Foundation;using MonoMac.AppKit;using MonoMac.ObjCRuntime; 
static class Program        {      			static void Main (string[] args)                {                        MonoMac.AppKit.NSApplication.Init ();                                               using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {                                MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();                                MonoMac.AppKit.NSApplication.Main(args);                        }                }        }               class AppDelegate : MonoMac.AppKit.NSApplicationDelegate        {				MonoMac.AppKit.NSWindow app_window;				public AppDelegate()				{					app_window = new MonoMac.AppKit.NSWindow(new RectangleF(800,480,0,400),NSWindowStyle.Borderless,NSBackingStore.Buffered,true);					app_window.MakeKeyAndOrderFront(this);				}	        }
But the application don't fint info.plist:
mono[1304:903] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
How I can build a simple executable ora a .net dll like Linux or Windows without bundle structure ?
Luca  
Subject: Re: [Mono-osx] Create window at runtime
From: troy-dawson at comcast.net
Date: Mon, 16 Jan 2012 15:31:53 -0800
CC: mono-osx at lists.ximian.com
To: farolfo at hotmail.com



On Jan 16, 2012, at 3:23 PM, De Santis Luca wrote:On the other toolkits like GTK 
or Winform I can create window at 
runtime, they don’t need of file like xib. I like know if on MonoMac I can make something like that, without load xib 
file.

Sure.
NSWindow has a designated initializer that you can use to instantiate NSWindows (and subclasses of NSWindows) via a new call. Eg (AppWindow is a subclass of NSWindow):
		public AppDelegate()		{			app_window = new AppWindow(new RectangleF(100,100,600,400-44));
			app_window.MakeKeyAndOrderFront(this);		}
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20120202/61876de3/attachment.html>


More information about the Mono-osx mailing list