stop NSSearchField editing selected row in NSOutlineView
stop NSSearchField editing selected row in NSOutlineView
- Subject: stop NSSearchField editing selected row in NSOutlineView
- From: sqwarqDev <email@hidden>
- Date: Sun, 20 Mar 2016 09:48:40 +0000 (GMT)
I have an OutlineView inside a SplitView in an NSPanel.
I've been trying to implement an NSSearchField for the OutlineView. The behaviour I want is simply for the outline view to select the first hit that matches the search term. I've had no problems getting the actual search to work just fine, but the problem is if I hit return again while a row is selected in the outlineView. When that happens, the textField in the row gets edited to whatever the stringValue of the NSSearchField is, including if it's nil (in other words, it will replace the text in the textField in my OutlineView with an empty string).
I've been all round the houses trying to figure this out. I thought initially it was to do with my search code, but in fact the behaviour occurs even if the NSSearchField's target action is an empty stub, and it also occurs even with a regular NSTextField dragged straight out IB's object library.
I have tried various things such as trying to deselect the row in the OutlineView, trying to make the NSSearchField resign FirstResponder, and trying to interfere with the field editor using endEditingFor: Alas, these were all red herrings, and I remain stuck with my problem.
I have determined that when the NSSearchField's action is sent when a row is selected in the outlineView, it is triggering my outlineView's - (NSView*)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item method.
Why would this be? I have not connected the _searchField in IB or in code to the OutlineView, and they do not share the same delegate (in fact with or without a delegate for the _searchField, the undesirable behaviour remains).
How can I stop the NSSearchField from editing the selected row?
TIA
Best
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden