Global Variable

NSAcceleratorButton

On pressure-sensitive systems, such as systems with the Force Touch trackpad, an accelerator button sends repeating actions as pressure changes occur. It stops sending actions when the user releases pressure entirely. A media player app, for example, might implement an accelerator button in order to allow a user to adjust the speed of fast forward or rewind with variable pressure. In this case, actions are sent to the app to indicate when pressure on the button has changed. The app would then determine the amount of pressure currently applied, and adjust playback speed accordingly.

Declaration

const NSButtonType NSAcceleratorButton;

Discussion

An accelerator button sends an action when the user first clicks the button and continues sending actions until pressure on the button is released entirely.

For continuous accelerator buttons (see continuous), the interval between repeating actions (a rate typically specified with setPeriodicDelay:interval:) automatically adjusts to match the applied pressure. As the user force clicks (presses harder), actions are sent more rapidly. As the user reduces pressure on the button, actions slow down. As such, the user has direct control over how fast actions are sent. Continuous accelerator buttons are intended for continuously advancing through a series of discrete objects, such as photos in an album or pages in a book.

For noncontinuous accelerator buttons, actions are sent whenever a change in force occurs. Noncontinuous accelerator buttons are intended for adjusting the speed of navigation, such as playback speed in a media player, based on pressure. Once the button is released, a final action is sent.

For buttons that are not accelerator buttons, the value of the button matches its state. For accelerator buttons, the value of the button is distinct from its state, and indicates pressure level. While the user force clicks the button, doubleValue is a measurement of pressure between 1.0 and approaching 2.0. When released, doubleValue is 0.0.

An accelerator button appears like any other button and does not provide any visual indication that it supports variable pressure. To provide this type of visual indication, you can apply a custom image to the button.

On a system that doesn’t support pressure sensitivity, an accelerator button behaves like a button of type NSMomentaryLightButton.