[Mono-osx] MonoMac - FileRegistration - FileOpen best practices

Frank Krueger fak at kruegersystems.com
Mon Jun 6 12:50:41 EDT 2011


You should be using a document based preset. Don't worry about the use of
the word "Document". Just translate that in your head as "Do I want to Open,
and Save multiple files at a time in my app". You almost always want a
Document based app in OSX. Only exceptions are for small utilities (but
honestly, most of those should be Doc based too).

In Windows, the normal app interface is 1 window per process per document.
But there are also (ugly) MDI interfaces that are 1 window per document with
many documents in 1 process.

That is the methodology Cocoa uses - 1 process, multiple documents. In fact,
it's more extreme than WIndows because it's not standard to ever run
multiple processes of the same app.

Before writing an OSX app, you should get very familiar with how other OSX
apps function. Play with TextEdit to see how a classic MDI interface should
work. Play with Pages and Numbers to see how professional-quality MDI apps
work. In other words, try to absorb the Mac way of thinking of GUIs.




On Wed, Jun 1, 2011 at 9:31 AM, trip <andywhitt at gmail.com> wrote:

> Sorry I'm new to developing on OSX and wondered if you could give me a
> little
> help. Coming from a Windows environment I'm used to double clicking on a
> registered filetype and a new process starting. This doesn't appear to be
> the case with OSX, so I was wondering how best to handle this.
>
> For example, my application is registered with launchservices for ".trip"
> files (VIEWER), when this ".trip" file is double clicked I want to start a
> new NSWindowController. But creating a new View controller on the FileOpen
> results in a crash, (something to do with same thread I think) e.g
>
> public override bool OpenFile (NSApplication sender, string filename)
> {
>        System.Console.WriteLine("OpenFile " +filename);
>        var mainWindowController = new MainWindowController(filename);
>        mainWindowController.Window.Center();
>        mainWindowController.Window.MakeKeyAndOrderFront(this);
>        return true;
> }
>
> I wondered what was the correct practice for opening multiple files? I
> looked at the Document Preset but thats not quite right for me, as my files
> arnt documents as such.
>
> Thanks
>
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/MonoMac-FileRegistration-FileOpen-best-practices-tp3566269p3566269.html
> Sent from the Mono - OSX mailing list archive at Nabble.com.
> _______________________________________________
> 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/20110606/06314518/attachment.html 


More information about the Mono-osx mailing list