I should note that this will something like the following from a
typical Ruby script inside TM:
TextMate.call_with_progress(:title => 'Game Progress', :summary =>
'Playing the game...') do | dialog |
# start the process...
[...]
dialog.progressValue = 40
# do something else...
[...]
dialog.progressValue = 80
# finish up...
[...]
dialog.progressValue = 100
# make sure the user sees we've finished
sleep 2
end
On Nov 28, 2006, at 8:11 PM, Chris Thomas wrote:
On Nov 28, 2006, at 7:37 PM, Jacob Rus wrote:
� 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?
So how exactly would a progress dialog work? Must they be
indeterminate progress dialogs? Because it would be nice to have
moving bars sometimes.
Here's a quickie sample session from the command line using a
determinate progress dialog:
sorcerer% tm_dialog=/Users/chris/Library/Application\ Support/
TextMate/Support/bin/tm_dialog
# create and show the dialog
sorcerer% $tm_dialog -a --parameters '{title = "Game Progress";
summary = "Playing the game..."; progressValue = 10;}' $HOME/Library/
Application\ Support/TextMate/Support/nibs/ProgressDialog.nib
# ... which returns the usual plist ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
<plist version="1.0">
<dict>
<key>returnCode</key>
<integer>0</integer>
<key>token</key>
<integer>7</integer>
</dict>
</plist>
# ... fill the progress bar to completion ...
sorcerer% $tm_dialog -t 7 --parameters '{progressValue = 40;}'
sorcerer% $tm_dialog -t 7 --parameters '{progressValue = 80;}'
sorcerer% $tm_dialog -t 7 --parameters '{progressValue = 100;}'
# ...close the progress dialog.
sorcerer% $tm_dialog -x 7
The nib is set up so that you can specify the min and max values; it
defaults to 0/100, same as standard Cocoa. And, if you want
indeterminate instead, you can specify the isIndeterminate key for
the progress bar.
Chris
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev