Post

Replies

Boosts

Views

Activity

NSToolbarItemGroup dynamically update subitems in toolbar
Developing on Monterey 12.7.5 I'm having trouble with updating subitems on NSToolbarItemGroup when selecting the item directly from the NSToolbar items array. I select the group item off the items array on the toolbar, and then call setSubitems: on the item, with a new array of NSToolbarItems. The group item disappears from the toolbar. It seems to leave a blank invisible item in the toolbar taking up space. I can't manually reinsert the item into the toolbar until I drag out the blank item, then drag back in the real item. Once dragged back in from the palette it displays correctly. The workaround I've come up with is to remove the item with NSToolbar removeItemAtIndex: and reinsert it with NSToollbar insertItemWithItemIdentifier:atIndex:. This works to update the subitems. Every other toolbar item property that I've tried has been able to update the item directly in the toolbar. It's only the group item's subitems that don't want to update correctly. Is there a correct way to do this that I'm missing? Calling [toolbar validateVisibleItems] didn't seem to help.
0
0
77
4d
NSWindowToolbarStylePreference toolbar buttons don't have preference style
In Big Sur when I use window.toolbarStyle = NSWindowToolbarStylePreference and set toolbar.displayMode = NSToolbarDisplayModeIconAndLabel the toolbar buttons don't take on the Preferences style. The hover and click state is only over the icon when it should be a large box surrounding the icon and label. These are the normal toolbar button styles. How do I get the buttons to take on the Preferences style? I've had to resort to using window.contentViewController = NSTabViewController to get the right toolbar button style. Is there something special I need to do to get NSWindowToolbarStylePreference to work?
1
0
520
Apr ’24