Changing all items in NSPopup Button?

What’s the best way to change all the items in a NSPopup Button?

I tried this:

myPopUpButton's removeAllItems
myPopUpButton's addItemsWithTitles_(listOfNewItems)

But it doesn’t get past the first line. In the console I get: “Can’t get removeAllItems of «class ocid» id «data kptr00000000A02F610002000000»”

Actually, it does remove all the items in my NSPopup Button, but then throws this error.

As a little aside, I have been able to get it to work like so:

try
myPopUpButton's removeAllItems
end
myPopUpButton's addItemsWithTitles_(listOfNewItems)

But I’m not entirely happy with that. I’d rather not have an error in there.

myPopUpButton's removeAllItems()

d’oh

thanks

Actually, today I had trouble reading the state of a button.

this throws all sorts of errors:

myButton's |state()|

This works fine:

myButton's |state|

So why doesn’t this need the empty brackets when “removeAllItems()” does?

This should be:

myButton's |state|()

I see. What’s confusing me is that some methods don’t throw an error when you don’t include the brackets, like “state”, but other do, like “removeAllItems”.

It’s al much more clear now. Thanks