This patch extends the dialog server with (partial) support for allowing scripts to interact more directly with nibs. You can instantiate a nib without blocking, and later update the binding values.

Three new options to tm_dialog:

-a, --async-window Displays the window and returns a reference token for it
                              in the output property list.
 -x, --close-winow <token>    Close and release an async window.
-t, --update-window <token> Update an async window with new parameter values. Use the --parameters argument (or stdin) to specify the
                              updated parameters.

• This is sufficient for implementing progress dialogs and other 'broadcast' information. For two-way usage, there is no way to actually retrieve the parameter values from an async window. You would generally want to retrieve parameter values on a user action, and there isn't a way to perform a callback yet. Perhaps export a new IBAction from the File Owner that dumps the parameters to stdout?

• The token persists until the window is closed. It's not reused until the counter wraps (at 2^31, probably not an issue).

• There's a possibility that windows not attached to a process could be orphaned, which would require users to kill the window on the command line (if the window doesn't have a close box). If a script is handling errors properly, this shouldn't be a problem. You can already get into this situation now with CocoaDialog and suchlike, but the remedy is slightly different in that you will need to use tm_dialog to kill the window rather than killing an external process.

Comments? Code review? Break anything?

Chris


Attachment: TMDialogAsync.patch
Description: Binary data

_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev

Reply via email to