Package: gtk
Class gtk:toggle-button
Superclassesgtk:button, gtk:bin, gtk:container, gtk:widget, gtk:buildable, gtk:actionable, gtk:activatable, gobject:object, common-lisp:standard-object, common-lisp:t Documented SubclassesDirect SlotsDetails A gtk:toggle-button widget is a gtk:button widget which will
remain "pressed-in" when clicked.
Clicking again will cause the toggle button to return to its normal state. ![]() A toggle button is created by calling either the gtk:toggle-button-new or gtk:toggle-button-new-with-label functions. If using the former, it is advisable to pack a widget, such as a gtk:label or a gtk:image widget, into the container of the toggle button. See the gtk:button widget for more information. The state of a gtk:toggle-button widget can be set and retrieved using the gtk:toggle-button-active function. To simply switch the state of a toggle button, use the gtk:toggle-button-toggled function. CSS nodesExamples(defun example-grid-spacing () (gtk:within-main-loop (let ((window (make-instance 'gtk:window :type :toplevel :title "Example Grid Spacing" :border-width 12 :default-width 320)) (grid (make-instance 'gtk:grid :column-homogeneous t :column-spacing 6 :row-homogeneous t :row-spacing 6)) (button1 (make-instance 'gtk:toggle-button :label "More Row Spacing")) (button2 (make-instance 'gtk:toggle-button :label "More Col Spacing")) (button3 (make-instance 'gtk:button :label "Button 3"))) (g:signal-connect window "destroy" (lambda (widget) (declare (ignore widget)) (gtk:leave-gtk-main))) (g:signal-connect button1 "toggled" (lambda (widget) (if (gtk:toggle-button-active widget) (setf (gtk:grid-row-spacing grid) 24 (gtk:button-label widget) "Less Row Spacing") (setf (gtk:grid-row-spacing grid) 6 (gtk:button-label widget) "More Row Spacing")))) (g:signal-connect button2 "toggled" (lambda (widget) (if (gtk:toggle-button-active widget) (setf (gtk:grid-column-spacing grid) 24 (gtk:button-label widget) "Less Col Spacing") (setf (gtk:grid-column-spacing grid) 6 (gtk:button-label widget) "More Col Spacing")))) (gtk:grid-attach grid button1 0 0 1 1) (gtk:grid-attach grid button2 1 0 1 1) (gtk:grid-attach grid button3 0 1 2 1) (gtk:container-add window grid) (gtk:widget-show-all window)))) Signal DetailsThe "toggled" signallambda (togglebutton) :run-firstShould be connected if you wish to perform an action whenever the state of the toggle button is changed.
| Returned bySlot Access FunctionsInherited Slot Access FunctionsSee also |
2023-12-29