-1

In my code I am overriding the mouseDown(with event: NSEvent) however am finding that the mouse down event only fires once, when the NSTextField becomes firstResponder

class GSTextField: NSTextField {
    override func mouseDown(with event: NSEvent) {
        print("in mouse down")
        return super.mouseDown(with: event)
    }
}

What I am ideally trying to achieve is to track the insert point on every mouse click. This is needed later in my code.

I think this has something to do wiht the field editor for the NSTextField doing the work behind the scenes. Thanks GS

Gazing South
  • 115
  • 8

1 Answers1

2

@willeke response gave me a workable solution I moved form trapping mouseDown() to using textViewDidChangeSelection()

The question about why mouseDown() only fires once is still outstanding however I no longer need to resolve that.

Gazing South
  • 115
  • 8