• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re:(new problem) Selecting item in NSTableView when right-clicked on...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:(new problem) Selecting item in NSTableView when right-clicked on...


  • Subject: Re:(new problem) Selecting item in NSTableView when right-clicked on...
  • From: Nils Hjelte <email@hidden>
  • Date: Tue, 26 Aug 2003 00:40:18 +0200

On mendag, aug 25, 2003, at 17:41 Europe/Stockholm, Nils Hjelte wrote:

I have an NSTableView with an contextmenu attached to it. When the user right-clicks on an item in the NSTableView the contextmenu is brought up correctly, but I also want the clicked cell to be selected. Is there some cleaner/better way of doing this than to subclass NSTableView and tracking mouse events?

// Nils Hjelte

Ok, so I subclassed NSTableView and implemented the rightMouseDown method. To select the row I simulate a left-mouseclick and then continue with the right-mouseclick. The method looks like this:

- (void)rightMouseDown:(NSEvent *)theEvent
{
/* Simulate a click with left mouse button to select row */
[super mouseDown:theEvent];
[super mouseUp:theEvent];
/* Continue with right-click to bring up context-menu */
[super rightMouseDown:theEvent];
}

This doesn't work though. The problem is when I right-click an item in the table view it correctly selects the item, but it doesn't bring up the context-menu until I make a new left-click in the table view. What should I do?

// Nils Hjelte
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re:(new problem) Selecting item in NSTableView when right-clicked on...
      • From: Glenn Andreas <email@hidden>
References: 
 >Selecting item in NSTableView when right-clicked on... (From: Nils Hjelte <email@hidden>)

  • Prev by Date: Can I have QuickTime player opened a movie file right after it is lauched
  • Next by Date: Re: Apple Help Interface Guidelines
  • Previous by thread: Selecting item in NSTableView when right-clicked on...
  • Next by thread: Re:(new problem) Selecting item in NSTableView when right-clicked on...
  • Index(es):
    • Date
    • Thread