On Mon, Dec 8, 2008 at 12:57 AM, Chris Hiszpanski <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to write a very simple oscilloscope in Cocoa as a shell tool that > continuously reads samples via standard input and draws them as a waveform > in a window. I do _not_ want a menu bar (i.e. an application), just one > window that disappears when the parent shell tool receives the interrupt > signal. > > - How can I create a window without creating a full fledge application (i.e. > without creating an instance of NSApplication)?
Can't be done. NSApplication is a prerequisite to creating windows with Cocoa. NSApplication is not incompatible with a shell tool as others have mentioned so you can simply do this *with* an instance of NSApplication, however I would like to point out a couple of alternative strategies that you may not have considered. 1) Build a real application, with a .app and everything. Build it so that it can be invoked from the command line, by typing out the full path to the bundled executable. Look at PackageMaker for an example of this. (With the dev tools installed in the standard location, type /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker --help) A GUI application can still be launched from the shell, read command-line parameters, and interact with stdio. If the long path is inconvenient, make a symbolic link to it somewhere. 2) Build a real application that doesn't get invoked from the shell, but does normal application-like things. Build a companion shell tool which you can invoke from the command line. Have it read whatever command line options you have and grab the data from stdin, then pass those on to the GUI application by using some IPC mechanism, such as distributed objects, mach ports, or whatever. This gives you a nice clean separation between the CLI and GUI pieces of your puzzle. Mike _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
