Validation

Validation works by setting the validateCommand option to a script which will be evaluated according to the validate option as follows:

none
Default. This means no validation will occur.
focus
validateCommand will be called when the spinbox receives or loses focus.
focusin
validateCommand will be called when the spinbox receives focus.
focusout
validateCommand will be called when the spinbox loses focus.
key
validateCommand will be called when the spinbox is edited.
all
validateCommand will be called for all above conditions.

It is posible to perform percent substitutions on the validateCommand and invalidCommand, just as you would in a bind script. The following substitutions are recognized:

%d
Type of action: 1 for insert, 0 for delete, or -1 for focus, forced or textvariable validation.
%i
Index of char string to be inserted/deleted, if any, otherwise -1.
%P
The value of the spinbox should edition occur. If you are configuring the spinbox widget to have a new textvariable, this will be the value of that textvariable.
%s
The current value of spinbox before edition.
%S
The text string being inserted/deleted, if any. Otherwise it is an empty string.
%v
The type of validation currently set.
%V
The type of validation that triggered the callback (key, focusin, focusout, forced).
%W
The name of the spinbox widget.

© Author | Home | Sitemap