From: Dave Howell Date: 2006-02-11T07:37:41+09:00 Subject: Re: [RubyCocoa] setting the items of anÊNSPopUpButton programmatically On Feb 4, 2006, at 1:23, Une b�vue wrote: > if i try : > > @choixTheme.addItem("Unbelievable") > i get an error : That'd be because (as far as I can tell) it doesn't have an "addItem" method. :) > then, what's the correct way to setup all the items of a NSPopUpButton > programmatically ? > itemArray = ["Unbelievable","Believable"] @choixTheme.removeAllItems @choixTheme.addItemsWithTitles(itemArray) @choixTheme.selectItemWithTitle(itemArray[0]) I "removeAllItems" because there are some in it when I create it in InterfaceBuilder, and I just didn't care to bother figuring out how to place a completely empty pop-up button. :) Also, I sometimes refresh it, and just emptying it and refilling from scratch is easier than modifying what's there. I'm sure there are other ways to do this as well.