hey, completely frustrated here. I just can't get it underway, and troubleshooting docs do not exist, so any help would be appreciated.
what i am doing:
I'm writing a control class for onscreen elements, that is a subclass of NSResponder. And then the intention is to insert my class into the responder chain right after the ViewController. Ideally, the ViewController will get mouse events from the view (confirmed), and then pass them to my subclass up the responder chain (this is where things go off the rails.)
things I know that are going to be asked:
does my view class accept firstResponder : yes.
class firstResponderView : NSView{
override var acceptsFirstResponder: Bool{
get{
return true
}
}
}
does my subclass accept first responder : yes.
override var acceptsFirstResponder : Bool {
get{
return true
}
}
do I add my subclass to the responder chain? i try to. in the debugger i get no indication that my setting the property in the ViewController, does anything. the NextResponder property is populated, but it's not my subclass.
currently in the ViewController's viewDidLoad() method:
self.nextResponder = (quadManip as NSResponder)
previously in my NSResponder subclass, when I thought setting the NSResponder was going to be fairly straight forward:
func joinResponderChain(_ responder : NSResponder){
responderParent = responder // this is a class property, so that I can put things back the way I found them, later.
let temp = responderParent?.nextResponder
responderParent?.nextResponder = self
self.nextResponder = temp
}
results: when my viewController gets the mouseDown event, I have written an override so that I can see what's going on :
override func mouseDown(with event: NSEvent) {
if let next = self.nextResponder{
next.mouseDown(with: event)
}
}
and there is definetly a nextResponder, but it is not the one I have set. it has never been the one I have set, and my subclass's mouse handling methods are never called.