Reputation: 866
This is a very simple issue that I know I've encountered before, but for the life of me, I can neither remember the solution nor find a page describing it:
I have an NSTableView bound to a content array. When I click on rows with the cursor, the table sends an action that I can handle. When I navigate within the table with the up/down arrow keys, it doesn't send the action.
I've verified that "Column Select" is disabled (this is the equivalent of the old "Full Row Select" option, right?) and have tried setting the NSTableView to Continuous... no luck.
Help pls? Thanks...
Upvotes: 1
Views: 408
Reputation: 6918
I can't find documentation that explains exactly when an NSTableView
calls the action that belongs to its target, but from what you say it seems to be specifically linked to a mouse-down event in the table. By thinking of it as a 'selected-row' action you may be generalizing more than is justified. Instead, perhaps you should think of it as a 'mouse-down-in-table' action in which case it's behaving exactly as it should - the action fires only when you mouse down. Such an event will often result in a selection change, but not always - and as you're finding out the selection can change independently of mouse-down events.
Instead of using the table's action to catch selection changes, it's much more common to use the various NSTableView
delegate methods. Is there a reason you aren't using these?
These provide more detailed information about how the selection is changing, and they'll catch changes triggered by any kind of event (mouse, keyboard, or programmatic)
Upvotes: 4