Skip to content

Commit 2bc99b7

Browse files
committed
Add example with slider to set time
1 parent e661823 commit 2bc99b7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/LiveWeb-Examples/LWAnalogClock.class.st

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ LWAnalogClock class >> exampleThreeOClock [
2323
^ aLWAnalogClock class new time: (Time hour: 15 minute: 7 second: 20)
2424
]
2525

26+
{ #category : #'as yet unclassified' }
27+
LWAnalogClock class >> exampleWithSlider [
28+
<lwExample: 'Slider to set any time of day'>
29+
| aLWAnalogClock range |
30+
aLWAnalogClock := self new time: (Time seconds: 0).
31+
range := LWBlockContainer new block: [ :h |
32+
h div: {#width->'100%'} with: [
33+
h input: { #value -> 0. #width -> '100%'.
34+
#type -> 'range'. #min -> 0. #max -> 43200.
35+
#style -> 'display: inline-block; width: 100%;'.
36+
#oninput -> (Js call: [ :v | aLWAnalogClock time: (Time seconds: v asInteger) ] with: 'window.event.target.value')}] ].
37+
^ LWContainer new
38+
add: aLWAnalogClock;
39+
add: range; yourself
40+
]
41+
2642
{ #category : #initialization }
2743
LWAnalogClock >> initialize [
2844
super initialize.

0 commit comments

Comments
 (0)