[TxMt] tm_dialog quandry (returning array selections)

Allan Odgaard throw-away-1 at macromates.com
Sat Nov 18 11:07:18 UTC 2006


On 18. Nov 2006, at 02:01, Brett Terpstra wrote:

> Okay, let's say I've got an NSScrollView tied to an  
> arrayController.  Heck, let's say I've got a few tied into  
> eachother to create a tree.  The plist passes nested arrays  to  
> allow a user to, say, pick a Backpack page->note->edit the note and  
> return to TM where the script takes the updated note and returns it  
> to Backpack.
>
> I've got the first half all finished, but the plist that comes back  
> to TM just contains the whole array including the edited note and  
> there's no easy way to tell what's changed.  How do I pass back the  
> id's of the selected page/note and the note body separately or  
> marked as modified?

Do I spot two questions here:

  Q: How do I know which items in an array was edited?
  A: No other way than iterate the data and compare with the original

  Q: How do I get the selected item back
  A: Bind your okay button’s target to selection.controller  
[NSObjectController]
     Bind the first argument to the selected object from the root  
array controller
     Put returnArgument: as the selector for one of the above two  
bindings.

     See http://lists.macromates.com/pipermail/textmate/2006-November/ 
015321.html for more verbose explanation.





More information about the textmate mailing list