NSTextField losing Focus/FirstResponder when mouse leaves NSWindow - cocoa

I have a NSTextField in an NSWindow, when I highlight the text to change it, the highlight is blue. If, while the TextField still has focus, I move my mouse outside of the NSWindow; my NSTextField loses focus and the highlight is now gray. I basically want to keep focus on the NSTextView no matter where the mouse goes, unless they click outside, hit enter, or hit tab. (End Editing)
Has anybody seen this before or know a solution to the problem?
Thanks in Advance

Turns out to be a problem with the outside view having a mouseentered event that would take control of the mouse

Related

Expand tooltip on hover in NSCollectionView not working after ReloadData or tab change

I have an NSCollectionView inside a Tab which contains subviews with NSTextField that have expanding tooltips.
Strangely, after a new search (ReloadData) or going to a tab and coming back, the tooltips no longer expand. They come back only if I resize the window or scroll the CollectionView*. Clicking in the view does not help. What can I do to automatically have the tooltips work?
*This triggers the CollectionView and the CollectionViewItems to UpdateTrackingAreas. I tried to force this on ReloadData even delayed 1000 ms, but this did not make the tooltips able to expand.
Thoughts:
Something related to UpdateTrackingAreas but not exactly?
Maybe a first responder issue?
It also doesn't work if the window is not the active window (which is ok)
Concerned that it might be related to How do I update the expansion tooltip size after calling NSTextField setStringValue:?

Disable mouse events on NSSplitView

Could anyone can disable or prevent mouse cursor changed when move mouse to divider of NSSplitView ?
I have a NSWindow with splitView inside, then I try to add a NSView/NSButton to window's contentView to prevent mouse events. What I gain is prevent mouse click, but I need to prevent the mouse cursor changed when I move mouse to splitView's divider below.
So what I try to do is:
Add a view on top to prevent user click on splitView and mouse cursor does not changed.
Like Sparrow app when Ads shown.
Any kind of hint, help, experience is highly appreciated!
On your NSSplitView you could add:
[self addCursorRect:[self bounds] cursor:[NSCursor whateverCursorYouWant]];
Have a look at Apple's sample code DragItemAround

Make the mouse cursor stay visible while typing in NSTextField

In OS X, the mouse cursor typically disappears when you are typing in a text field, in every app. Even when I am typing in this text field here on Stack Overflow, the cursor disappears.
This makes sense most of the time. But in my app I want it to stay visible, because the user has to do a lot of clicking between text fields, and it is really nasty when the mouse is always gone.
How can I make the cursor stay visible when typing in an NSTextField?
Ok, I solved it.
When you add a breakpoint at +[NSCursor setHiddenUntilMouseMoves:] you will notice, that it is called by [NSTextField keyDown:]
Apple says it is no good idea to override this method in order to prevent the mouse from disappearing. So I used NSTextFieldDelegate to get notified on -(void)controlTextDidChange:(NSNotification *)obj and -(void)controlTextDidEndEditing:(NSNotification *)obj. Then I called [NSCursor setHiddenUntilMouseMoves:NO]
It is not 100% clean but it works.
Big thanks to Richard and Kurt for their great help :)
It would be my guess that it is deep in apples code for the mouse to disappear when typing. Because even when you just start typing the mouse disappears, outside of a textbox even. Like when you click inside a browser window and type.

NSResponder mouseExited when hovering Window title

I have an NSWindow with an NSToolbar and a content view.
I have set the tracking area to be the whole frame of the view.
I wish to have the mouseExited event fired when the cursor leaves the content view and enters the toolbar and/or the window title. What is the best way to achieve this? should I bound the tracking area to just below the toolbar?
The main reason I need this is because my view needs a special cursor. So I'm changing it in mouseEntered and wish to change it again when mouseExited
Thanks
Why not add a cursor rectangle over the entire bounds of the view?

Mouse over effect on touchscreen

Obviously you dont have a mouse over effect on a touchscreen, but I would like some effect, maybe onclick? Does anybody have any suggestions?
On the touchscreen I'm working with right now, the mouse over is a persistent effect of clicks. In other words, it's as if after clicking an item with an actual mouse and releasing the button, one never moved the mouse pointer afterwards.

Resources