I want to trigger mouse right click actions whenever the user hits the mouse button while pressing the control key.
This has until now been accomplished by replacing a mouse click event with the control key modifier with a mouse right click event inside a specialisation of the NSApplication method nextEventMatchingMask:untilDate:inMode:dequeue::
So can you tell med what I am missing? Or should this not be handled in the NSApplication subclass at all? Thank you very much in advance!
This has until now been accomplished by replacing a mouse click event with the control key modifier with a mouse right click event inside a specialisation of the NSApplication method nextEventMatchingMask:untilDate:inMode:dequeue::
Code Block //When current event matches mouse click with ctrl key pressed create mouse right click event event = [NSEvent mouseEventWithType:NSEventTypeRightMouseDown ...] //Discard current event and replace it with the new event [_currentEvent release]; _currentEvent = event; [event retain];
This works, but manipulating _currentEvent directly is no longer allowed. I then tried to use the following to discard the current event and replace it:Code Block [self postEvent:event atStart:YES]; [self discardEventsMatchingMask:mask beforeEvent:event];
Although the new event does get inserted into the queue, the original event is still there. So can you tell med what I am missing? Or should this not be handled in the NSApplication subclass at all? Thank you very much in advance!