Right-mouse events are defined by the Application Kit to open contextual menus, but you can override this behavior if necessary (in, for example, rightMouseDown:). However, you can specifically request these events by sending the NSWindow object an setAcceptsMouseMovedEvents: message with an argument of YES. Note: Because mouse-moved events occur so frequently that they can quickly flood the event-dispatch machinery, an NSWindow object by default does not receive them from the global NSApplication object. ![]() Each event type is, in turn, related to an NSResponder method, as Table 4-1 shows for left-button mouse events. Mouse events are of various event types related to the mouse button pressed (left, right, other) and the nature of the action on the mouse button. If the user clicks a view that isn’t in the key window, by default the window is brought forward and made key, but the mouse event is not dispatched. Subsequent key events are dispatched to that view object if it accepts first responder status. Mouse events are dispatched by an NSWindow object to the NSView object over which the event occurred. See Using Tracking-Area Objects for information on this subject.īefore going into the “how to” of mouse-event handling, let’s review some central facts about mouse events discussed in Event Architecture, Event Objects and Types, and Event Handling Basics: ![]() It does not describe how to handle mouse-entered and mouse-exited events, which (possibly along with mouse-moved events) are used in mouse tracking. ![]() Note: This chapter discusses those mouse events that an NSWindow object delivers to its views through the event-dispatch mechanism: mouse-down, mouse-up, mouse-dragged, and (to a lesser degree) mouse-moved events.
0 Comments
Leave a Reply. |