A
push-button
is a pane that displays either a piece of text or an image and when it is pressed it performs an action.
A callback invoked on Microsoft Windows, Cocoa and GTK+ when pressing the mouse button over the
push-button
while a platform-specific modifier key is held down.
A callback invoked on Microsoft Windows, GTK+ and Motif when pressing the mouse button over the
push-button
.
The class
push-button
inherits most of its behavior from button. Note that it is normally best to use a
push-button-panel rather than make the individual buttons yourself, as the button panel provides functionality for handling groups of buttons. However, push buttons can be used if you need to have more control over the button's behavior.
press-callback , if non-nil, should be a function which is called when the user presses the mouse left button over the push button. The arguments to press-callback are as specified by callback-type . This initarg is not supported on Cocoa.
alternate-callback
, if non-nil, should be a function. On Microsoft Windows and GTK+, it is called instead of
callback
when the button is clicked with the
Control
key held down. On Cocoa, it is called instead of
callback
when the button is clicked with the
Command
key held down.
alternate-callback
is not implemented for Motif or for other classes of button.
(setq button (capi:contain
(make-instance
'capi:push-button
:text "Press Me"
:data '(:some :data)
:callback #'(lambda (data interface)
(capi:display-message
"Pressed ~S"
data)))))
(capi:apply-in-pane-process
button #'(setf capi:button-enabled) nil button)
(capi:apply-in-pane-process
button #'(setf capi:button-enabled) t button)