Re: commandline tool should start Cocoa GUI
Re: commandline tool should start Cocoa GUI
- Subject: Re: commandline tool should start Cocoa GUI
- From: Bob Ippolito <email@hidden>
- Date: Tue, 22 Feb 2005 02:51:36 -0500
On Feb 22, 2005, at 1:46 AM, Sven Hoffmann wrote:
I have a commandline tool that should, for test reasons, load and
launch a Cocoa Bundle.
For that purpose I wrote a few C wrapper functions into the Bundle’s
Controller that initialize Cocoa, create NSApp, load the nibfile and
so on.
When started and given the according arguments the commandlinetool
brings up the GUI, but most of the interface elements, namely
NSTextfields, don’t react to typing in text. I can select a textfield,
but there is no reaction to pressing keys. The only interface elements
that react are ones that are I connected to action methods of the
controller in Interfacebuilder. So I can press the quit button, for
example.
Instead when I type text it goes to wherever the commanndline tool is
run from, that is the run console, the debugger console or a terminal.
I know that The Bundle does work, when incorporated into a Carbon GUI
Application.
Now my feeling is, that because there is a no-GUI application before
the GUI is brought up, there is no responder for the events sent from
the window server for the GUI.
If anybody has suggestions on how to resolve this problem, please let
me know.
Short answer - you don't - an application bundle is necessary.
If your argv[0] does not point to the innards of an application bundle,
then you simply can not make this work unless you call into
undocumented Apple SPI. The solution to your problem is to have a
command-line tool stub that simply execve's another executable that is
actually inside an application bundle (a symlink won't work, because it
won't have a correct argv[0]). Note that you can use a shell script to
do this too. See /usr/bin/pythonw for an example.
-bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden