I need to display a popover when i place the cursor on a cell of the table view. On OS X app, what is the technique to show a NSPopover when the mouse is over a NSTableViewCell? Thanks
Asked
Active
Viewed 1,015 times
0
-
possible duplicate of [mouseover detection in NSTableView's NSCell?](http://stackoverflow.com/questions/2786751/mouseover-detection-in-nstableviews-nscell) – Parag Bafna Mar 01 '13 at 10:59
-
@trojanfoe you have specified once you did this in your app. Can you pls guide me? – user2118335 Mar 01 '13 at 11:34
1 Answers
3
Implement the mouseMoved:
message for your table view and call performSelector:withObject:afterDelay:
from there. Cancel previous requests with NSObject:cancelPreviousPerformRequestsWithTarget:selector:object
before doing this (and in dealloc). This will constantly restart a timer when the mouse moves. The given selector will be executed after the delay is over and mouse has not been moved since then. In the selector you can then get the current mouse position and show the popover.
Don't forget to remove the popover when the mouse starts moving again.

Mike Lischke
- 48,925
- 16
- 119
- 181