[TxMt] tm_dialog: Populating a dropdown.

Henrik Nyh henrik at nyh.se
Thu Apr 5 11:09:10 UTC 2007


Andrew Henson wrote:
> TM_DIALOG …
> in my dropdown, I can't figure out a way to get it to default to a given 
> item so to workaround it I just added it twice, once at the top of the 
> list so it's displayed by default and again in it's rightful alphabetic 
> order. I'd definitely like to know if anyone can tell me a better way to 
> do this.

I think you should be able to bind (in the Inspector, when the dropdown 
is selected) the selectedIndex to

Bind to: Parameters (or whatever you call that object controller)
Controller key: selection
Model key path: whateverYouWantToCallIt

This assumes you're using a NSPopUpButton (the dropdown with up-down 
arrows). Things might be different for other kinds of dropdowns.

If you set things up this way, you should be able to give a value for 
the key whateverYouWantToCallIt in the in-parameters to determine what 
item is selected, and the out-parameters will have such a key as well.




More information about the textmate mailing list