Re: NSSavePanel called from BSD application - no keyboard input
Re: NSSavePanel called from BSD application - no keyboard input
- Subject: Re: NSSavePanel called from BSD application - no keyboard input
- From: Kevin Martin <email@hidden>
- Date: Tue, 10 Feb 2009 19:24:17 +0000
2) Register with the window server as an application. Use
TransformProcessType() for this.
Thanks guys. This function looks very one way though. Ideally I would
like to turn
myself into a proper application, run the dialog, and then go back to
a being a console
application. However it does not look as if this is possible.
Be aware that accessing the GUI like this from a CLI process is not
really very well supported. You might want to consider writing a small
helper .app instead and calling out to that.
This looks like the best way to do it. But as it's only me who runs a
Mac, I don't really
need the nice dialogs, and will just cope with having to type the
filenames.
Chances are I will write a wrapper app in the future, but I'm not
familiar enough with
Cocoa at the moment. Reading through the docs I can't even figure out
how I would do non
blocking i/o with an NSPipe, Never mind how I would communicate the
non-textual information
between the two processes.
One other note on your code, you do not want to use
NSASCIIStringEncoding to convert the filename to a C string. This will
fail badly for non-ASCII characters, which are perfectly legal in OS X
paths.
I knew that - I return false if it fails to convert the string, but it
was the most
suitable method I found.
Use the -fileSystemRepresentation method.
A ha! I hadn't got that far down the API. I was thinking what I wanted
was a C string,
so I was looking in the section for converting to C strings. Thanks
for that.
How long does it take to be familiar with the most commonly used
classes do you think?
Thanks,
Kevin Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden