NSPopUpButtonCell in a Table View

There was a post on the AS Studio mailing list about this last week but there were no responses. Does anyone know how to target and manipulate an NSPopUpButtonCell in a table view from AS? The new PB that comes with Xcode allows you to easily add a popup button to a table column but I don’t know how to target those popups. Any ideas?

Thanks,
Jon

Has anyone figured this out, or have we few dedicated souls just let this one slide? :cry:

It seems that apple “forgot” to provide documentation for ANY of the new data cell types available in xcode (but impossible to use via applescript?). I’ve got image, button, and text cells down…but the methods of both writing to and reading from the others are eluding me. I’m most interested in using popup button cells, but having some solid documentation somewhere about ALL of these different cell types would be useful, eh? I’ll be holding hands with my mac on my deathbed… but it really gets me sometimes how many holes there are in apple’s documentation, and how they could have provided a lot more for us in their example projects than they have.

Anyone with knowledge of how to use a popup button cell in a table view, please drop us a few morsels so we can spread the wealth.

Thanks everyone…
j

I’m not sure there is documentation but I did answer this (the post seems to have been lost in site maintenance). Below is a script snippet that shows targeting a table, adding the values to the default NSPopupButtonCell and then loading the table with data including changing the selected menu item of the popup per row. The example assumes you’ve got a data source for the table already and that the table has two columns with the popup button added to the second column from within IB.

Some things to know about NSPopupButtonCells, every cell in a table has the same value. By that I mean the list associated with the cell is always the same for every row, it can’t change per row. The selection can change but not the list itself. Next, the value of the cell is not the title of the menu item but the zero-based index of the list selection. You’ll have to either already know the list items and get the offset of the value (+1) of the cell to get the item in the list or query the cell through a call method for the list items and then determine the value.

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thank you very much for your reply, Jon. I remembered seeing some notes about this, but came up with only this post when searching for info about this at macscripter. Actually, I’ve been searching the internet for info regarding this, and I do believe that this post here is the only place you will find this information on earth. :lol: Seriously. There is plenty of mention about it in the obj-c world, but applescript docs make no reference to it. I saw the “addItemsWithTitles” method in apple’s documentation, but am still not in the obC way. :rolleyes: I appreciate your filling in the gap.

Thanks again…
j

PS: You’re probably not counting :wink: but congrats on another milestone…1500 posts. You’re making a huge difference here.