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
0
votes
2 answers

NSView disable smooth scrolling

I have an MTKView where I'm rendering a triangle and I want to be able to translate it using the two-finger drag gesture that calls the scrollWheel: method. The default behavior of the scrollWheel: method is to produce extra scrolling events to…
0
votes
1 answer

Catch unhandled keyboard events in Cocoa

I'm working on a Cocoa app. I would like to catch all keyboard events that are not being handled by any responder, and report them to Google Analytics. For this purpose, I would like to set a custom NSResponder that implements keyDown: as the next…
Yoav
  • 5,962
  • 5
  • 39
  • 61
0
votes
1 answer

Undo makeFirstResponder

I want an NSTextField that prevents empty strings so I subclassed the NSTextField and implemented this method -(void) textDidEndEditing:(NSNotification *)aNotification { if([[self stringValue] isEqualToString:@""]) { NSBeep(); [[self…
stupot
  • 13
  • 3
0
votes
2 answers

Standard mac key bindings behaving erratically

I am trying to use the standard mac keybindings (found in ~\Library\KeyBindings\DefaultKeyBinding.dict) to map to the action methods found in NSResponder. I am overriding these action methods in one of my custom classes to perform custom navigation…
Sam
  • 2,745
  • 3
  • 20
  • 42
0
votes
1 answer

NSView getting dragged events when dragging window

In my app there's the strange issue that a custom NSView receives forwarded mouseDragged events when the window is dragged around the screen, usually by its toolbar. From the stack trace it seems that the Cocoa frameworks do this on their…
cacau
  • 3,606
  • 3
  • 21
  • 42
0
votes
1 answer

What is the usage of NSResponder's indent:?

NSResponder has a method you override called - indent:, but unsure when it would normally be activated.
Jeffrey Drake
  • 805
  • 10
  • 26
0
votes
1 answer

NSButton: setting different focus ring color

I'm trying to set the NSButton focus ring color to white. Currently, when the button has firstResponder, it shows a blue outline. I am aware that there is the drawFocusRingMaskWithFrame:inView: to help do this, but I'm not sure how to use this to…
Z S
  • 7,039
  • 12
  • 53
  • 105
0
votes
0 answers

NSResponder methods only calling setNeedsDisplay

I have a subclass of an openGl view. In one of the methods, I set a flag to draw the background black or white. At the end of the method i call setNeedsDisplay. This never gets called! I have a setNeedsDisplay also in the mouseDownEvent. When I…
0
votes
1 answer

Why can I click an NSButton if it's not first responder?

I'm trying to implement a class like NSResponder in C++, on thing I don't understand is this: All keyboard/mouse interactions are sent to the first responder, so if for example a NSTextField is currently the first responder, how does another…
levidhuyvetter
  • 401
  • 5
  • 16
0
votes
1 answer

looking for a better way to activate and deactive background of text fields in my GUI (Cocoa OSX)

I have a small gui app that consists selectable groups, each groups has a disclosure button to display its sub-group, an image and a text field. When you are editting a text field and select another group or another text field I want to end…
Mike2012
  • 7,629
  • 15
  • 84
  • 135
0
votes
1 answer

NSButton makeFirstResponder

I have a simple Mac app with a window. In this window, I have two NSTextfields and one NSButton. When the window appears, the first NSTextfield has the focus. I press enter and the focus passes to the second NSTextfield. I press enter again and the…
Max Colla
  • 61
  • 4
0
votes
1 answer

-[NSResponder showContextHelp:] example

I'm curious with the method -showContextHelp: in NSResponder. The documentation states: Implemented by subclasses to invoke the help system, displaying information relevant to the receiver and its current state. How and when is this method called?…
pfandrade
  • 2,359
  • 15
  • 25
0
votes
1 answer

How can the arrow keys be allowed to operate for graphical NSDatePicker?

This seems simple, but essential. Place an NSDatePicker (style: graphical) into a window, build & run, then attempt to use arrow keys to move around. The only response is a 'ding' from the computer. I've overridden -keydown in a simple custom…
David
  • 3,285
  • 1
  • 37
  • 54
0
votes
1 answer

How to find an Object (Controller or View) resigned first Responder?

I would like to do some cleanup activity when a particular object resigns the FirstResponder. Is there any way to detect whether object has resigned first responder status. What methods I need to implement to know this? Any pointers for this? I…
Ram
  • 1,872
  • 5
  • 31
  • 54
0
votes
1 answer

NSControl subclass shouldn't change firstResponder

I implemented a tabbar view as an NSControl subclass. When I click it, AppKit will try to update the firstResponder of my NSWindow. Because I don't want the tabbar to become firstResponder (acceptsFirstResponder returns NO) the NSWindow itself will…
DrummerB
  • 39,814
  • 12
  • 105
  • 142