Hi there,
is there any way of populating a dropdown with a Hash/Array from Ruby, using tm_dialog?
I'm using a custom Nib, but I don't have too much experience with Interface Builder.
Dummy code:
categories = ["bar","baz"] dialog = ENV['DIALOG'] plist = { 'title' => "Add your title", 'category' => categories # How do I use this here? }.to_plist str = `#{e_sh dialog} "#{NIBS}/new_message.nib/" -m -p #{e_sh plist}`
Any hints will help :)
Also... is there any way of calling tm_dialog to load a custom Nib using the Ruby wrapper in dialog.rb?
Thanks in advance!
-- Ale Muñoz http://sofanaranja.com http://bomberstudios.com
Hi Ale,
The short answer is yes! Have a look at a bundle I wrote for Snipplr.
http://www.elaptics.co.uk/fileadmin/repository/tmbundles/Snipplr2.zip
I populate the list of languages supported by Snipplr in the Post Snippet nib. Give me a shout off list if any of it doesn't make sense. I'll be interested to know if there is a better way of doing it as it seems a little bit more convoluted than it feels like it should be.
Andy
On 2 Apr 2007, at 20:28, Ale Muñoz wrote:
Hi there,
is there any way of populating a dropdown with a Hash/Array from Ruby, using tm_dialog?
I'm using a custom Nib, but I don't have too much experience with Interface Builder.
Dummy code:
categories = ["bar","baz"] dialog = ENV['DIALOG'] plist = { 'title' => "Add your title", 'category' => categories # How do I use this here? }.to_plist str = `#{e_sh dialog} "#{NIBS}/new_message.nib/" -m -p #{e_sh plist}`
Any hints will help :)
On 4/2/07, Andrew Henson elaptics@googlemail.com wrote:
Hi Ale,
The short answer is yes! Have a look at a bundle I wrote for Snipplr.
http://www.elaptics.co.uk/fileadmin/repository/tmbundles/Snipplr2.zip
It hasn't been easy, but I managed to get it working :)
Do you know where could I get more information about Interface Builder? Obviusly, you know your stuff pretty well ;)
Anyways, thanks a lot for the info (and for the Snipplr bundle, I didn't know about it). It will be used for übercool stuff...
-- Ale Muñoz http://sofanaranja.com http://bomberstudios.com
On 3 Apr 2007, at 07:41, Ale Muñoz wrote:
On 4/2/07, Andrew Henson elaptics@googlemail.com wrote:
Hi Ale,
The short answer is yes! Have a look at a bundle I wrote for Snipplr.
http://www.elaptics.co.uk/fileadmin/repository/tmbundles/Snipplr2.zip
It hasn't been easy, but I managed to get it working :)
Great!
Do you know where could I get more information about Interface Builder? Obviusly, you know your stuff pretty well ;)
Actually I don't know much at all about interface builder. I muddled my way through looking at articles I found on Apple's site and other bundles,etc. I had been hoping that Allan would have had chance to put together some more screencasts about the TM_DIALOG which might have included some use of the other controls. I'm not sure that what I did is the best solution by far. It still seems kludgey to me, for example 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.
Andy
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.