开发者

Different cells in NSTableView together with bindings

im working on a nstableview that contains information for some properties that are dynamicly created. Each row contains some cells that are common (name for example), but in one column they have different cells. Some properties will have NSSliderCell, other NSButtonCell etc. All of this is binded up to a NSDictionaryController. I've got the basics to work with nsslidercell and nsbuttoncell using -(NSCell *) 开发者_如何学JAVAtableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row in my delegate, and returning different cells for each row. And the nstablecolumn has a binding from the property's value (usually a nsnumber) to the value of the column.

This all works, but now i wanted to add a NSSegmentedCell to a new property type, and i experienced problems, because i now needed to bind the value of the property to the selectedIndex of the column, and not the value. But how can i do this without breaking the other properties?

I've also tried to subclass NSSegmentedCell, and make objectValue controlling the selectedIndex of it, but it didn't work...

Any ideas how to do this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜