Cocoa: stopping the keyview loop in a custom NSView

I am implementing a custom NSView that draws a graph. The tab key cycle stops at NSView and then gets stuck there. This is one of several views, the other is the classes provided by the system. They are represented at the peer level in the window. The tab between peer views works fine.

It is configured as follows:

  • I am loading a window from XIB.

  • NSView is software distributed and added to the window.

  • I confirmed that the AutorecalculatesKeyViewLoop window is set (just for fun, I also tried recalculateKeyViewLoop after adding the view).

  • The view behaves correctly in all other respects, including resizing.

  • If I click on a peer object and then overlay a tab on it, when tabbing other peer objects become key, as they should.

  • When a custom NSView becomes a key, the tab key stops the key view from moving to another peer view. Shift tab will not back up.

Nearby, as I can say, this should be automatic, but it does not work.

I have acceptFirstResponder, startFirstResponder and resignFirstResponder to return YES.

I confirmed that resignFirstResponder is never called.

I probably don't see the obvious step when setting up a custom NSView; any suggestions?

+4
source share

Source: https://habr.com/ru/post/1529248/


All Articles