nspopupbuttoncell

Getting duplicate header button cell in NSTableView when using NSPopUpButtonCell

一曲冷凌霜 提交于 2019-12-21 02:54:48
问题 I have a dynamic NSTableView which can add a number of columns depending on the data provided. For each column I have set the header cell to be a NSPopUpButtonCell. (Side-note: I've had to use a custom subclass class for NSTableHeaderView otherwise the menu doesn't pop-up). All works well, apart from a duplicate or extra header button cell on the top right. It mirrors perfectly the previous column selection as shown in screenshots. My question is how do I stop the NSTableView from recycling

How to retrieve the current selection of an NSPopUpButtonCell?

拥有回忆 提交于 2019-12-13 02:08:31
问题 I am using an NSPopUpButtonCell in an NSTableView . The popup button has a binding to an NSArray property offered by the ApplicationDelegate . When I select a menu item of the popup button I expect to retrieve the current selection or its index . I added an IBAction to being informed and also set up an NSMenuDelegate . Both return index = 0 at all times. // indexOfSelectedItem is always 0. NSInteger indexOfSelectedItem = [m_popUpButtonCell indexOfSelectedItem]; I created an example project

Getting duplicate header button cell in NSTableView when using NSPopUpButtonCell

浪尽此生 提交于 2019-12-03 08:43:36
I have a dynamic NSTableView which can add a number of columns depending on the data provided. For each column I have set the header cell to be a NSPopUpButtonCell. (Side-note: I've had to use a custom subclass class for NSTableHeaderView otherwise the menu doesn't pop-up). All works well, apart from a duplicate or extra header button cell on the top right. It mirrors perfectly the previous column selection as shown in screenshots. My question is how do I stop the NSTableView from recycling the previous popup header cell? (By the way I have tried the setCornerView method but that only effects