cocoa - How to know which NSTableView opened a Contextual Menu? -


I have 5 examples of NSTableView that are the same context menus. When I get the message that the menu has been clicked, I have to know which table has sent it, I have checked the NSMenu documentation, but I think which menu of the menu opens to see There is no way ..

I am thinking about NSTableView subclassing and send a message to the representative menufore events, will this be the best way?

UPDATE:

Thank you Joshua, I'm demonstrating the work schedule for 5 days using 5 tables. Each table represents a weekday, and I added contextual menu to add and remove tasks. So when a user clicks on "add work" on a weekday, I have to know which one is working by sub-closing this menu and sending a message to the delegate when the menu is opened. In this way my controller knows what the final table was to call the menu. But this does not seem like the best implementation to do this, perhaps as you said the problem is on UI, what do you think? Jose

I do not see a way to get this information. The menu is not anything "attached"; They are appearing in a single place - your menuforEvent: Override can work, but it gives me billiards.

Although this is not the answer to your question, I accept my first reaction. "Why do you have many tables with the exact same menu?" It kills me more as a UI problem Someone thinks that a relevant menu will be quite specific for a specific type of object (or for its viewing), which it represents. This question asks: Why do you have 5 table ideas that have the exact reference? If all the 5 tables represent those things which are controlled by the controller (possibly) in the same way, then it is highly likely that there is a better way to represent your "collection of things" than 5 different tables .

I have been given many impressions, but my curiosity is getting me the best, I think: -)


Comments