[SVN] r6309

Chris Thomas chris at cjack.com
Thu Dec 7 15:37:55 UTC 2006


Add a new Dialog class to exploit the async window options in tm_dialog. You can interact with dialogs on the fly by updating their parameter bindings (contrived example):

Dialog.dialog('NetworkAssimilator.nib', parameters) do |dialog|
  dialog.wait_for_input do |params|
    if params['disableNetworkAccess'] == true
      dialog.parameters = {'hideNetworkButton' => true}
    else
      dialog.parameters = {'hideNetworkButton' => false,
                                 'exampleText' => 'network wins again!'}
    end
  end
end

It would be possible to make this code slightly easier to write, with some judicious use of method_missing, but I haven't implemented it yet:

    dialog.parameters.hide_network_button = 'Complete!'

(Less efficient for updates of multiple parameters, of course, but you're not likely to notice the difference.)

Changed:
U   trunk/Support/lib/dialog.rb



More information about the textmate-dev mailing list