The same view used in 2 menu items

  • I have an NSOutlineView in a window. One of the columns uses an NSPopUpButtonCell (a subclass actually). The menu contains 1 menu item, which shows an NSView. This window also has an NSPopUpButton whose menu contains 1 menu item, which also shows an NSView. When I try using the same NSView in both places, they don't show up. Is there some trick to sharing the same view among 2 menu items? Or can I use the same menu in both places? I'm out of my Cocoa comfort zone here, code-wise and Interface Builder-wise.

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
  • On May 24, 2013, at 11:28 AM, Steve Mills wrote:

    > I have an NSOutlineView in a window. One of the columns uses an NSPopUpButtonCell (a subclass actually). The menu contains 1 menu item, which shows an NSView. This window also has an NSPopUpButton whose menu contains 1 menu item, which also shows an NSView. When I try using the same NSView in both places, they don't show up. Is there some trick to sharing the same view among 2 menu items? Or can I use the same menu in both places? I'm out of my Cocoa comfort zone here, code-wise and Interface Builder-wise.

    Although two menus won't be visible at the same time, you don't control when the view is placed into the menu's view and apparently Cocoa can't sort it out on its own. Using the same menu for both popups will work. Just set the same menu for both — I think IB won't let you so you'll have to use code. Otherwise, just make two menus.

    --
    Seth Willits
  • On May 24, 2013, at 13:40:34, Seth Willits <slists...>
    wrote:

    > Although two menus won't be visible at the same time, you don't control when the view is placed into the menu's view and apparently Cocoa can't sort it out on its own. Using the same menu for both popups will work. Just set the same menu for both — I think IB won't let you so you'll have to use code. Otherwise, just make two menus.

    Thanks! Yes, I've noticed that you can't right-drag from a popup control to a different menu without IB leaving the existing menu show in the connections (as disabled), and you can't delete the menu in a popup.

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today