Questions tagged [nsresponder]

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.

106 questions
5
votes
1 answer

Cocoa: Forward actions (copy:, paste: etc.) up to the responder chain

I have a subclass of NSOutlineView that implements copy:, paste:, cut: etc. Also, the NSDocument subclass implements these same methods. When the outline view is in the responder chain (is first responder or a parent view of it), all copy/paste…
Micha Mazaheri
  • 3,481
  • 1
  • 21
  • 26
4
votes
3 answers

View interpretKeyEvents: but pass unwanted ones up the responder chain?

I'd really like my custom view to work with -moveLeft:, -deleteForward:, -selectAll:, etc., but I'd also like to pass any keys I didn't care about onward up the responder chain. Right now I'm overriding -keyDown: to call [self…
andyvn22
  • 14,696
  • 1
  • 52
  • 74
4
votes
2 answers

mouseDragged events get stolen by another view

I have several views of class MyView (subclass of NSView) inside another NSView. MyView implements -mouseEntered:, -mouseExited:, -mouseDown:, -mouseDragged:, and -mouseUp:. Almost always, when a MyView receives a mouse-down event, all subsequent…
jlstrecker
  • 4,953
  • 3
  • 46
  • 60
4
votes
1 answer

Inertial Scrolling & -ScrollWheel: on OS X

THE PROBLEM: I have an NSScrollView. I'm using it to implement a custom "Table View" with rows of data that are actually NSViews. (Note: this is not an instance of NSTableView.) As I scroll vertically (there is no horizontal scrolling), I use a…
Bryan
  • 4,628
  • 3
  • 36
  • 62
4
votes
2 answers

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

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…
Sam
  • 2,745
  • 3
  • 20
  • 42
4
votes
0 answers

initialFirstResponder not getting the focus ring on start

I set the initialFirstResponder of window in my AppDelegate on launch (to a custom NSTextField). I expected that this would cause the NSTextField derivative to launch with the blue focus ring around it - it does NOT. Only on a single TAB from the…
Sam
  • 2,745
  • 3
  • 20
  • 42
4
votes
0 answers

Visualize first responder?

Is there some kind of AppKit/NSDocument/NSApplication debugging option, debugging flag or other third-party extension to visualize the current firstResponder for any given NSWindow instance in the current application? We're building a single-window…
ATV
  • 4,116
  • 3
  • 23
  • 42
4
votes
3 answers

Getting Key down event in an NSView controller

I'm trying to find a solution that allows me to get keydown events in a view controller. I do not believe a view controller is part of the responder chain by default. I would appreciate a sample of how to go about this. I have had trouble finding…
Miek
  • 1,127
  • 4
  • 20
  • 35
3
votes
4 answers

Forwarding drag & drop event to parent view

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…
guitarflow
  • 2,930
  • 25
  • 38
3
votes
1 answer

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…
Chen Harel
  • 9,684
  • 5
  • 44
  • 58
3
votes
1 answer

Custom NSStoryboardSegue not adding NSViewController to Responder Chain

Overall goal: Use a custom storyboard segue on macOS The issue at hand is the responder chain. According to Apple: In addition, in macOS 10.10 and later, a view controller participates in the responder chain. NSViewController If I use a standard…
Zelko
  • 3,793
  • 3
  • 34
  • 40
3
votes
1 answer

NSView/NSResponder smartMagnify:

I am trying to implement smartMagnify: in an NSView, but it is never called. I have rotate:, magnify:, etc., and they are all being called successfully - what do I need to do to receive this message? I've searched the documentation, which is…
Grimxn
  • 22,115
  • 10
  • 72
  • 85
3
votes
0 answers

Non-NSView NSResponder to handle NSDocument responder actions

My NSDocument subclass (MyDocument) is quite large and I was thinking about making a MyDocumentResponder (subclass of NSResponder) to handle document responder events in order to clean up the code. This seems better to me than a category on…
Trygve
  • 1,317
  • 10
  • 27
3
votes
2 answers

Why are NSResponder's keyboard actions not being called?

NSResponder defines numerous actions that are related to keyboard actions like moveUp:, moveUpAndModifySelection: and moveToBeginningOfLine:. With the exception of the actions that aren't triggered by pressing a modifier key (e.x. moveUp: is simply…
kennyc
  • 5,490
  • 5
  • 34
  • 57
3
votes
0 answers

NSResponder: Overriding mouseDown:, mouseDragged:, mouseUp:

I have difficulties to understand what happens when one overrides mouse events in an NSView. In the following sample both methods are called by the Cocoa framework: - (void)mouseDown:(NSEvent *)theEvent { NSLog(@"mouseDown"); } -…
user1360618