context menu based on NSTableViewCell

后端 未结 7 888
余生分开走
余生分开走 2021-02-03 12:16

i would like to place a context menu onto a NSTableView. this part is done. what i would liek to do is to show different menu entries based on the content of the ri

7条回答
  •  南旧
    南旧 (楼主)
    2021-02-03 12:43

    I also tried the solution posted by Warren Burton and it works fine. But in my case I had to add the following to the menu items:

    [item1 setTarget:self];
    [item2 setTarget:self];
    

    Setting no target explicitly causes the context menu to remain disabled.

    Cheers!

    Alex

    PS: I would have posted this as a comment but I do not have enough reputation to do that :(

提交回复
热议问题