Instance Method

trackMarker:withMouseEvent:

Tracks the mouse to add aMarker based on the initial mouse-down or mouse-dragged event theEvent.

Declaration

- (BOOL)trackMarker:(NSRulerMarker *)marker withMouseEvent:(NSEvent *)event;

Discussion

Returns YES if the receiver adds aMarker, NO if it doesn’t. This method works by sending trackMouse:adding: to aMarker with theEvent and YES as arguments.

An application typically invokes this method in one of two cases. In the simpler case, the client view can implement NSRulerView to invoke this method when the user presses the mouse button while the cursor is in the NSRulerView’s ruler area. This technique is appropriate when it’s clear what kind of marker will be added by clicking the ruler area. The second, more general, case involves the application providing a palette of different kinds of markers that can be dragged onto the ruler, from the ruler’s accessory view or from some other place. With this technique the palette tracks the cursor until it enters the ruler view, at which time it hands over control to the ruler view by invoking trackMarker:withMouseEvent:.

See Also

Adding and removing markers

markers

The receiver’s ruler markers to markers, removing any existing ruler markers and not consulting with the client view about the new markers.

- addMarker:

Adds aMarker to the receiver, without consulting the client view for approval.

- removeMarker:

Removes aMarker from the receiver, without consulting the client view for approval.