Instance Method

menuForEvent:

Overridden by subclasses to return a context-sensitive pop-up menu for a given mouse-down event.

Declaration

- (NSMenu *)menuForEvent:(NSEvent *)event;

Parameters

theEvent

An object representing a mouse-down event.

Discussion

The view can use information in the mouse event, such as its location over a particular element of the view, to determine what kind of menu to return. For example, a text object might display a text-editing menu when the cursor lies over text and a menu for changing graphics attributes when the cursor lies over an embedded image.

The default implementation returns the view’s normal menu.

See Also

Managing Contextual Menus

defaultMenu

Overridden by subclasses to return the default pop-up menu for instances of the receiving class.

- willOpenMenu:withEvent:

Called just before a contextual menu for a view is opened on screen.

- didCloseMenu:withEvent:

Called after a contextual menu that was displayed from the receiving view has been closed.