Package: gtk
Class gtk-spin-button
Superclassesgtk-entry, gtk-widget, gtk-buildable, gtk-editable, gtk-cell-editable, gtk-orientable, g-object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct SlotsDetails A gtk-spin-button widget is an ideal way to allow the user to set the
value of some attribute. Rather than having to directly type a number into a gtk-entry widget,
the spin button allows the user to click on one of two arrows to increment or
decrement the displayed value. A value can still be typed in, with the bonus
that it can be checked to ensure it is in a given range. The main properties of a gtk-spin-button widget are through an adjustment. See the gtk-adjustment class for more details about an adjustment's properties. Note that the spin button will by default make its entry large enough to accomodate the lower and upper bounds of the adjustment, which can lead to surprising results. Best practice is to set both the width-chars and max-width-chars poperties to the desired number of characters to display in the entry. CSS nodesspinbutton.horizontal ├── undershoot.left ├── undershoot.right ├── entry │ ╰── ... ├── button.down ╰── button.upThe gtk-spin-button implementation main CSS node has the name spinbutton. It creates subnodes for the entry and the two buttons, with these names. The button nodes have the .up and .down style classes. The gtk-entry subnodes, if present, are put below the entry node. The orientation of the spin button is reflected in the .vertical or .horizontal style class on the main node. Example(let (... (spinner (make-instance 'gtk-spin-button :adjustment (make-instance 'gtk-adjustment :value 50.0 :lower 0.0 :upper 100.0 :step-increment 1.0 :page-increment 5.0 :page-size 0.0) :climb-rate 0 :digits 0 :wrap t))) Style Property Details
Signal DetailsThe "change-value" signallambda (spin-button scroll) : ActionKeybinding signal which gets emitted when the user initiates a value change. Applications should not connect to it, but may emit it with the function g-signal-emit if they need to control the cursor programmatically. The default bindings for this signal are Up/Down and PageUp and/PageDown.
The "input" signallambda (spin-button new-value) : Run LastCan be used to influence the conversion of the users input into a double float value. The signal handler is expected to use the function gtk-entry-text to retrieve the text of the entry and set new-value to the new value. The default conversion uses the function g_strtod().
The "output" signallambda (spin-button) : Run LastCan be used to change the formatting of the value that is displayed in the spin buttons entry. (let (... ;; A spin button for a number (spinner1 (make-instance 'gtk-spin-button :adjustment (make-instance 'gtk-adjustment :value 1.0 :lower -10000.0 :upper 10000.0 :step-increment 0.5 :page-increment 100.0 :page-size 0.0) :climb-rate 1.0 :digits 2 :wrap t)) ;; A spin button for the digits to display (spinner2 (make-instance 'gtk-spin-button :adjustment (make-instance 'gtk-adjustment :value 2 :lower 1 :upper 5 :step-increment 1 :page-increment 1 :page-size 0) :climb-rate 0.0 :digits 0 :wrap t))) ;; Customize the appearance of the number (g-signal-connect spinner1 "output" (lambda (spin-button) (let ((value (gtk-adjustment-value (gtk-spin-button-adjustment spin-button))) (digits (truncate (gtk-adjustment-value (gtk-spin-button-adjustment spinner2))))) (setf (gtk-entry-text spin-button) (format nil "~@?" (format nil "~~,~d@f" digits) value))))) ... )
The "value-changed" signallambda (spin-button) : Run LastIs emitted when the value represented by spin-button changes. Also see the "output" signal.
The "wrapped" signallambda (spin-button) : Run LastIs emitted right after the spin button wraps from its maximum to minimum value or vice versa.
| Slot Access Functions
Inherited Slot Access FunctionsSee also |
2021-2-10