Reputation: 1101
I am writing a Cocoa app and do not want it focus on mouse click it, but I found no way to implement yet. Any one can give me suggestions ?
Upvotes: 2
Views: 1575
Reputation: 1101
I've finally found a solution!
Create a subclass of NSView, and reimplement the following methods:
-(BOOL) shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent
{
return YES;
}
-(void) mouseDown:(NSEvent *)theEvent
{
[NSApp preventWindowOrdering];
}
and set the contentView property of the created NSWindow, and set the window style mask to NSBorderlessWindowMask , and it works.
Upvotes: 5
Reputation: 664
Select the Table View in Interface Builder. There is a "Focus Ring" Attribute, change it to "None". I set all these attributes in Scroll View, Clip View, and Table View.
Hope it help.
Upvotes: 0
Reputation: 177
There is method(s) you may override in your subclass with returning NO
-(BOOL)acceptsFirstResponder
-(BOOL)becomeFirstResponder
Upvotes: 1