Re: flagsChanged: not being called on NSControl subclass

James Walker

On 5/17/19 11:22 PM, Steve Mills via Groups.Io wrote:
What do you have to do these days to make this work? I tried returning YES from acceptsFirstResponder, as was suggested somewhere.
There is 1 NSTrackingArea added to the view, using options NSTrackingCursorUpdate | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways | NSTrackingInVisibleRect | NSTrackingEnabledDuringMouseDrag.
isOpaque returns NO.
Not sure what else to try. Just trying to set the cursor when modifiers change.

Does your control actually become first responder? That might be necessary for flagsChanged: to go to your control.

A less than perfect option would be to poll the modifier flags on mouse moves.

Another option might be to use +[NSEvent addLocalMonitorForEventsMatchingMask:handler:].

The only case in which I have personal experience with receiving NSFlagsChanged is when I wrote my own local event loop that repeatedly called -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:].

Join to automatically receive all group messages.