NSResponder is a class used in Mac Development. NSResponder is an abstract class that forms the basis of event and command processing in the Application Kit. The core classes—NSApplication, NSWindow, and NSView—inherit from NSResponder, as must any class that handles events. The responder model is built around three components: event messages, action messages, and the responder chain.
Questions tagged [nsresponder]
106 questions
0
votes
1 answer
Perform different actions on button up and down
Ok. I've been digging around trying to find a way to capture button up and down actions. I'm not even sure what the proper terminology in Xcode for this would be. It's pretty easy in MS Visual, but I can't seem to find how to do this with Xcode. …

butteryak
- 11
- 2
0
votes
1 answer
Determine whether all controls can get focus (i.e. become first responder)
I need to detect whether any NSControl, such as an NSButton, can get the focus by using the Tab key.
It can, if the user has enabled the option in the System Preferences under Keyboard / Shortcuts / Keyboard / "Change the way Tab moves focus".
More…

Thomas Tempelmann
- 11,045
- 8
- 74
- 149
0
votes
1 answer
Direction that NSView received focus (tab or backtab)?
I have a custom view that has multiple components that can receive the focus, similar to NSDatePicker in the textFieldAndStepper style. If it gets the focus the first component is focused. You can then tab through the components. If you hit tab…

mistercake
- 692
- 5
- 14
0
votes
1 answer
NSTextField Loses Focus When Neighboring NSTableView Reloaded
I have a search field (NSTextField) called searchField and when you type in it, it refreshes the data shown in a NSTableView. The problem is that this refresh also triggers the selection of a table row, and that takes the focus out of the…

Clifton Labrum
- 13,053
- 9
- 65
- 128
0
votes
0 answers
supplementalTargetForAction:sender: doesn't get called
I am trying to send an action from a menu item to a child view controller of a NSSplitViewController. As I understand I am supposed to override supplementalTargetForAction:sender: on the splitViewController to provide the child view controller to…

de.
- 7,068
- 3
- 40
- 69
0
votes
1 answer
Replace the NSResponder of an existing NSView
I have a view in an drawing application, it needs to respond in an other way when an other tool is selected. I thought it would be much nicer to replace the NSResonder of that view in stead of setting every responder method of the view call the new…

kaibakker
- 301
- 3
- 13
0
votes
1 answer
Disabling right click in appkit
I'm currently taking in a nextEvent within my mouseDrag function
while true {
guard let nextEvent = self.window?.nextEvent(matching: [.leftMouseDragged, .leftMouseUp, .rightMouseUp]) else {
continue
}
switch…

Joel Tecson
- 45
- 6
0
votes
2 answers
How to tab to a Cocoa text editing field that is scrolled out of view
I've got a window with a single text editing field next to a scrolling view. The document view of the scrolling view contains multiple sub-views, and some of those sub-views contain text editing fields created programmatically as NSTextViews.
When…

jsbox
- 304
- 2
- 11
0
votes
1 answer
Why should -[NSTextInputClient doCommandBySelector:] not pass the event up the responder chain?
A text view should not forward uninvokable commands up the responder chain, the docs say for -[NSTextInputClient doCommandBySelector:]:
If aSelector cannot be invoked, then doCommandBySelector: should not pass this message up the responder chain.…

ctietze
- 2,805
- 25
- 46
0
votes
1 answer
NSView - Quick Look and NSResponder
I've subclassed NSView (MyCustomView) and have added it to my NSWindow's Content View in InterfaceBuilder using the custom view object in MainMenu.xib.
I have since added code to accept Quick Look responses to MyCustomView.
After calling…

mootymoots
- 4,545
- 9
- 46
- 74
0
votes
1 answer
Nested NSScrollViews that can be scrolled with different gestures?
I've got an app with an NSScrollView nested inside another NSScrollView. I'd like the user to be able to scroll the inner scrollview using two-finger swipe, and to scroll the outer scrollview using three fingers.
I imagine I'll need to somehow…

nate777
- 174
- 2
- 9
0
votes
1 answer
Handling tabs in Cocoa view containing a text field and scrolling view
In my Cocoa app, I have a window that contains an NSTextField (as is) and an NSScrollView (sub-classed). I've got an NSViewController that manages the window's NSView containing the text field and scrolling view.
At app startup, the NSTextField has…

jsbox
- 304
- 2
- 11
0
votes
1 answer
NSResponder and multiple NSTableView - who sent message?
I've got two NSTableView in a single NSViewController, and each has their own NSArrayController to handle what exists. I'm now trying to wire up the Edit->Delete button. How do I know, when the delete method is called, 'who' sent that…

Gargoyle
- 9,590
- 16
- 80
- 145
0
votes
0 answers
NSResponder print: call going to wrong place
In my NSViewController I placed a print(_:) method, but it's not being called when I hit print. Instead, the print is being captured by the current NSTextField that I'm in. How do I force the print call to go into the view controller? I defined…

Gargoyle
- 9,590
- 16
- 80
- 145
0
votes
1 answer
Unable to get mouse events to register in custom NSViewController
Here's my code, simplified for brevity:
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
var fooController: FooController!
func applicationDidFinishLaunching(aNotification: NSNotification) {
…

Charlie Schliesser
- 7,851
- 4
- 46
- 76