|
Class: SteppingSlider
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--ScrollBar
|
+--SteppingSlider
|
+--HorizontalSteppingSlider
- Package:
- stx:libwidg2
- Category:
- Views-Interactors
- Version:
- rev:
1.15
date: 2021/01/20 15:41:17
- user: cg
- file: SteppingSlider.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
SteppingSliders are like Sliders, but add step-up and step-down
buttons (which increment/decrement the value).
(you can also think of them as a ScrollBar with a slider instead of
a scroller as component)
copyrightCOPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
model: aModel
-
set the model - forwarded to the thumb.
if nonNil, this will get the thumbs origin
via #value: messages
-
start: start stop: stop step: step
-
set start (min), stop (max) and step increment.
The increment is used when clicking on a step button
-
step
-
return the step increment.
The increment is used when clicking on a step button
-
step: aNumber
-
same as stepIncrement;
set the value used for stepping (defaults to 1)
-
stepIncrement: aNumber
-
set the value used for stepping (defaults to 1).
Same as #step: for compatibility.
event handling
-
keyPress: key x: x y: y
-
enabled ifFalse:[^ self].
initialization
-
createElements
-
create the scroller and the two step buttons
-
initialize
-
initialize; the increment is set to 1 (one)
misc
-
doesNotUnderstand: aMessage
-
forward any unimplemented message to the scroller
private
-
scrollStep: delta
-
step by some delta
-
scrollStepDown
-
sent when the step-down button is pressd
-
scrollStepUp
-
sent when the step-up button is pressd
non model operation:
|top sl|
top := StandardSystemView extent:200@200.
sl := SteppingSlider in:top.
sl origin:(0.0@0.0) corner:(sl width@1.0).
sl scrollAction:[:pos | Transcript showCR:pos].
top open
|
change the step:
|top sl|
top := StandardSystemView extent:200@200.
sl := SteppingSlider in:top.
sl origin:(0.0@0.0) corner:(sl width@1.0).
sl scrollAction:[:pos | Transcript showCR:pos].
sl stepIncrement:10.
top open
|
model operation (watch the value):
|model top sl fld|
model := 0 asValue.
top := StandardSystemView extent:200@200.
top label:'slider on model'.
sl := SteppingSlider in:top.
sl origin:(0.0@0.0) corner:(sl width@1.0).
sl model:model.
top open.
top := StandardSystemView extent:200@200.
top label:'inputField on model'.
fld := EditField in:top.
fld origin:(0.0@0.0) corner:(1.0 @ fld height).
fld converter:(PrintConverter new initForNumber); model:model.
top open
|
two views on the same model:
|model top sl fld|
model := 0 asValue.
top := StandardSystemView extent:200@200.
top label:'slider on model'.
sl := SteppingSlider in:top.
sl origin:(0.0@0.0) corner:(sl width@1.0).
sl model:model.
top open.
top := StandardSystemView extent:200@200.
top label:'slider on model'.
sl := ThumbWheel in:top.
sl origin:(0.0@0.0) corner:(20@1.0).
sl model:model.
top open.
|
|