All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

NextPrevUpTopContentsIndex

push-button

Class
Summary

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.

Package

capi

Superclasses

button
titled-object

Initargs

:alternate-callback

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.

:press-callback

A callback invoked on Microsoft Windows, GTK+ and Motif when pressing the mouse button over the push-button.

Accessors

button-alternate-callback
button-press-callback

Description

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.

Notes

callback (from superclass button) is the general callback, triggered when the user clicks the button, either by pressing and releasing the mouse button or by a keyboard gesture.

press-callback is called only when the user presses the mouse button.

Example
(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)
See also

radio-button
check-button
button-panel
push-button-panel
CAPI elements
Button elements
Creating Panes with Your Own Drawing and Input


CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017

NextPrevUpTopContentsIndex