Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSSearchField clear button does not respond to click

I am trying to clear field NSSearchField by clicking on the clear button on the right side. I am not able to click on it.

Here is a screen recording of what's happening at my end:

enter image description here

I used the following code found by RND:

[[[self.SrcFiled cell] cancelButtonCell] setAction:@selector(clearSearchField:)];
[[[self.SrcFiled cell] cancelButtonCell] setTarget:self];

But it is not working; I have no idea how to fix this issue. Please suggest how to fix this.

like image 872
Nitin Gohel Avatar asked May 21 '15 10:05

Nitin Gohel


2 Answers

It's very strange. I got solution by just change TextBorderType rectangle to rounded and this error got fix now i can able to click on clear button of NSSearchFiled. and that working smooth as expected.

Old one in this clear button not responding:

enter image description here

Now with change clear button responding:

enter image description here

like image 102
Nitin Gohel Avatar answered Oct 05 '22 12:10

Nitin Gohel


I had exactly the same issue, but my border was already set as shown in the accepted answer.

I found that my override of the mouseDown event, was blocking this behaviour.

- (void)mouseDown:(NSEvent *)theEvent
{
    NSLog(@"SearchField.h mouseDown");
}
like image 24
JonLord Avatar answered Oct 05 '22 12:10

JonLord