nsresponder

Keyboard focus lost after inserting and editing new object, when NSArrayController „Auto Rearrange Content“ is enabled

有些话、适合烂在心里 提交于 2019-12-09 23:48:13
问题 I have a master-detail kind of application OS X 10.9 only: An NSTableView on the left side of the window, the details as NSTextFields on the right side. I have not set the tab order specifically, out of the box works just fine. Except after inserting a new object: after inserting a new object the object is selected in the NSTableView. hit tab the first NSTextField is selected write something, hit tab now instead of selecting the next NSTextField nothing is selected, hit tab the NSTableView is

How to receive keyboard events for a NSView after exiting fullscreen mode?

我怕爱的太早我们不能终老 提交于 2019-12-07 06:11:07
问题 I subclass an NSView and start full screen mode when the application finished launching. The view is available as the property fooView in the application delegate. // AppDelegate.m - (void)applicationDidFinishLaunching:(NSNotification*)notification { [[self window] makeKeyAndOrderFront:self]; [[self fooView] enterFullScreenMode:[NSScreen mainScreen] withOptions:nil]; } The class FooView itself implements the following functions. // FooView.m - (void)keyDown:(NSEvent*)event { NSLog(@"%@ %@ - %

Forwarding drag & drop event to parent view

馋奶兔 提交于 2019-12-06 08:24:48
I have an application where I have one custom view which is derived from NSView. Within this view, there are several custom subviews, which are also derived from NSView. I want to implement a drag and drop behavior which allows URLs to be dropped onto the views. Everything is already working for the main view. So, actually I would have to implement dragging behavior handlers on the child-views and the parent-view class. The thing is, that I don't want to copy the complete handling code to all the child-views to make them also accept drag events. So I thought that it would be the best way to

How to intercept keystrokes from within the field editor of an NSTextField?

谁说我不能喝 提交于 2019-12-05 12:40:14
Intro When my custom NSTextField is in "text editing mode" and the field editor has been placed in front of it as firstResponder I no longer get the keystrokes through NSTextField.keyDown(...) . I understand that the keystrokes are now being routed through the field editor . Most online recommendations are to override the following method within the delegate of the custom NSTextField : control(_:textView:doCommandBySelector:) I have indeed overridden this method but it doesn't seem to get called? See code below: class FocusDelegate: NSObject, NSTextFieldDelegate{ func control(control:

Allow views in childWindow to become key without losing focus on parentWindow

丶灬走出姿态 提交于 2019-12-05 00:34:48
问题 I added a childWindow of a custom subclass of NSWindow to a parentWindow (also a custom subclass of NSWindow). The childWindow has the NSBorderlessWindowMask and canBecomeKeyWindow: is overridden to return YES and canBecomeMainWindow: to return NO. The childWindow is set to resize with the parentWindow. So I want to create the illusion that the views of the childWindow are part of the parentWindow. The main idea is to arrange the document windows created by the document-based application

Allow views in childWindow to become key without losing focus on parentWindow

牧云@^-^@ 提交于 2019-12-03 15:24:30
I added a childWindow of a custom subclass of NSWindow to a parentWindow (also a custom subclass of NSWindow). The childWindow has the NSBorderlessWindowMask and canBecomeKeyWindow: is overridden to return YES and canBecomeMainWindow: to return NO. The childWindow is set to resize with the parentWindow. So I want to create the illusion that the views of the childWindow are part of the parentWindow. The main idea is to arrange the document windows created by the document-based application within a main window to provide a tabbed interface (just like in a browser) to switch between the documents

Make NSView in NSPanel first responder without key window status

家住魔仙堡 提交于 2019-11-30 15:34:24
Is it possible to give an NSView inside an NSPanel first responder status without giving the NSPanel key window status (making the main application window resign key)? Thanks. Well, I ended up figuring this one out, but it took a lot of research so I'll post the details here in case anyone else runs into the same problem. First of all, a few basics: It's impossible to have 2 windows actually be key at the same time It's possible to fake a window into thinking it's key by overriding -isKeyWindow but that won't give the views contained in the window first responder status. My Scenario: I added a

Make NSView in NSPanel first responder without key window status

。_饼干妹妹 提交于 2019-11-29 21:42:02
问题 Is it possible to give an NSView inside an NSPanel first responder status without giving the NSPanel key window status (making the main application window resign key)? Thanks. 回答1: Well, I ended up figuring this one out, but it took a lot of research so I'll post the details here in case anyone else runs into the same problem. First of all, a few basics: It's impossible to have 2 windows actually be key at the same time It's possible to fake a window into thinking it's key by overriding

How to inspect the responder chain?

♀尐吖头ヾ 提交于 2019-11-28 06:25:01
I'm doing some crazy multiple documents inside a single window stuff with the document-based architecture and I'm 95% done. I have this two-tier document architecture, where a parent document opens and configures the window, providing a list of "child" documents. When the user selects one of the children, that document is opened with the same window controller and it places a NSTextView in the window. The window controller's document association is changed so that the "edited dot" and the window title track the currently selected document. Think of an Xcode project and what happens when you

How to add NSViewController to a responder chain?

让人想犯罪 __ 提交于 2019-11-27 21:31:18
I'm having hard time understanding and finding info about how to make NSViewController accept key and mouse events. I read somewhere that in order to register these events in NSViewController it should be added to a responder chain, but I can't find the answer how to properly do this. Any kind of help is highly appreciated! There's a nice tutorial found at CocoaWithLove.com . Summed up: you'll create a subclass of NSView (e.g. "EugeneView") and then that subclass will have some extra methods in it, such as " setNextResponder " and " setViewController ". And doing these two methods should get