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

text-input-range Class

Summary

The class text-input-range is a pane for entering a number in a given range. Typically there are up and down buttons at the side which can used to quickly adjust the value.

Package

capi

Superclasses

titled-object
simple-pane

Initargs
:start
An integer specifying the lowest possible value in the range.
:end
An integer specifying the highest possible value in the range.
:wraps-p
A generalized boolean.
:value
An integer specifying the current value in the pane.
:callback
A function called when the value is changed by the user.
:change-callback
A function called called when the user edits the text in the pane.
:callback-type
The type of arguments passed to the callback.
Accessors

text-input-range-start
text-input-range-end
text-input-range-wraps-p
text-input-range-value
text-input-range-callback
text-input-range-change-callback
text-input-range-callback-type

Description

The class text-input-range provides numeric input of integers in a given range (some systems refer to this a spinner or spin-box).

The range is controlled by the :start and :end initargs. start defaults to 0 and end defaults to 10. The initial value is set with the argument value (which defaults to 0).

wraps-p controls what happens if the user presses the up or down button until the start or end is reached. If wraps-p is nil, then it stops at the limit. If wraps-p is true then it wraps around to the other end. The default value of wraps-p is nil.

callback, if non-nil, should be a function to be called whenever the value is changed by the user. The arguments to callback are specified by callback-type (see the callbacks class for details of possible values, noting that the "data" is the value and the "item" is the pane itself). The default callback-type is (:item :data). Note that, if the value is changed by the user editing the text, then change-callback, if supplied, is called as well.

change-callback, if non-nil, should be a function of four arguments, to be called when the user edits the text in the pane. It should have this signature:

change-callback string pane interface caret-position

where the arguments are interpreted just as for the change-callback of text-input-pane. Note that editing of the text may or may not change the value in the text-input-range (that is, what text-input-range-value returns). If the value does change, then callback is called too.

Notes

On Cocoa, change-callback is not called for a cursor move only.

Examples
(capi:contain
 (make-instance 'capi:text-input-range
                :start 0 
                :end 100 
                :value 42))
(example-edit-file "capi/elements/text-input-range")
See also

text-input-pane
text-input-choice
option-pane


CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:42