spinner: make rebface [ tip: { USAGE: spinner spinner options [$1 $10 $1] data $5 DESCRIPTION: Similar to a field, with arrows to increment/decrement a value by a nominated step amount. OPTIONS: [min max step] block of minimum, maximum and step amounts } size: 20x5 text: "" edge: theme-edge font: default-font-right para: make default-para [] feel: edit/feel options: [1 10 1] ; min, max, increment pane: copy [] action: make default-action [ on-scroll: make function! [face scroll /page] [ face/text: either any [none? face/data page] [ form data: either negative? scroll/y [second face/options] [first face/options] ][ form face/data + either negative? scroll/y [last face/options] [negate last face/options] ] face/action/on-unfocus face ] on-unfocus: make function! [face] [ either empty? face/text [ face/data: none ][ face/data: any [attempt [to type? first face/options face/text] face/data] face/text: either face/data [form face/data: min max face/data first face/options second face/options] [copy ""] show face ] face/action/on-click face true ] ] init: make function! [/local p] [ all [data text: form data] all [not empty? text data: to type? first options text] para/margin/x: size/y - sizes/cell ; make up & down button p: self insert pane make arrow [ tip: none offset: as-pair p/size/x - p/size/y + sizes/cell 0 size: as-pair p/size/y - sizes/cell p/size/y / 2 span: all [ p/span case [ all [find p/span #L find p/span #W] [#OX] find p/span #W [#X] find p/span #L [#O] ] ] data: 'up edge: none action: make default-action [ on-click: make function! [face /local p] [ p: face/parent-face p/data: any [attempt [to type? first p/options p/text] p/data first p/options] p/data: p/data + third p/options if p/data > second p/options [p/data: second p/options] p/text: form p/data edit/unlight-text view*/caret: none show p p/action/on-click p ] ] ] pane/1/init insert tail pane make arrow [ tip: none offset: as-pair p/size/x - p/size/y + sizes/cell p/size/y / 2 size: as-pair p/size/y - sizes/cell p/size/y / 2 span: all [ p/span case [ all [find p/span #L find p/span #W] [#OX] find p/span #W [#X] find p/span #L [#O] ] ] edge: none action: make default-action [ on-click: make function! [face /local p] [ p: face/parent-face p/data: any [attempt [to type? first p/options p/text] p/data first p/options] p/data: p/data - third p/options if p/data < first p/options [p/data: first p/options] p/text: form p/data edit/unlight-text view*/caret: none show p p/action/on-click p ] ] ] pane/2/init ] esc: none caret: none undo: copy [] ]