|
Class: DigitalLedDisplay
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--DigitalLedDisplay
- Package:
- stx:libwidg3
- Category:
- Views-Misc
- Version:
- rev:
1.32
date: 2018/11/10 07:48:46
- user: cg
- file: DigitalLedDisplay.st directory: libwidg3
- module: stx stc-classLibrary: libwidg3
- Author:
- Claus Gittinger
a simple fun-view, displaying a numeric value as a 7-Segment LED-line.
The model is a simple ValueHolder, holding a number.
This widget can be used as a component in calculator-like applications.
DigitalClockView
Label
ValueHolder
image specs
-
led0
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led0 inspect
ImageEditor openOnClass:self andSelector:#led0
Icon flushCachedIcons
|
-
led1
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led1 inspect
ImageEditor openOnClass:self andSelector:#led1
Icon flushCachedIcons
|
-
led2
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led2 inspect
ImageEditor openOnClass:self andSelector:#led2
Icon flushCachedIcons
|
-
led3
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led3 inspect
ImageEditor openOnClass:self andSelector:#led3
Icon flushCachedIcons
|
-
led4
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led4 inspect
ImageEditor openOnClass:self andSelector:#led4
Icon flushCachedIcons
|
-
led5
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led5 inspect
ImageEditor openOnClass:self andSelector:#led5
Icon flushCachedIcons
|
-
led6
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led6 inspect
ImageEditor openOnClass:self andSelector:#led6
Icon flushCachedIcons
|
-
led7
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led7 inspect
ImageEditor openOnClass:self andSelector:#led7
Icon flushCachedIcons
|
-
led8
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led8 inspect
ImageEditor openOnClass:self andSelector:#led8
Icon flushCachedIcons
|
-
led9
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self led9 inspect
ImageEditor openOnClass:self andSelector:#led9
Icon flushCachedIcons
|
-
ledA
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledA inspect
ImageEditor openOnClass:self andSelector:#ledA
Icon flushCachedIcons
|
-
ledC
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledC inspect
ImageEditor openOnClass:self andSelector:#ledC
Icon flushCachedIcons
|
-
ledCol
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledCol inspect
ImageEditor openOnClass:self andSelector:#ledCol
Icon flushCachedIcons
|
-
ledE
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledE inspect
ImageEditor openOnClass:self andSelector:#ledE
Icon flushCachedIcons
|
-
ledF
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledF inspect
ImageEditor openOnClass:self andSelector:#ledF
Icon flushCachedIcons
|
-
ledMinus
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledMinus inspect
ImageEditor openOnClass:self andSelector:#ledMinus
Icon flushCachedIcons
|
-
ledOff
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledOff inspect
ImageEditor openOnClass:self andSelector:#ledOff
Icon flushCachedIcons
|
-
ledPeriod
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledPeriod inspect
ImageEditor openOnClass:self andSelector:#ledPeriod
Icon flushCachedIcons
|
-
ledb
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledb inspect
ImageEditor openOnClass:self andSelector:#ledb
Icon flushCachedIcons
|
-
ledd
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledd inspect
ImageEditor openOnClass:self andSelector:#ledd
Icon flushCachedIcons
|
-
ledo
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledo inspect
ImageEditor openOnClass:self andSelector:#ledo
Icon flushCachedIcons
|
-
ledr
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledr inspect
ImageEditor openOnClass:self andSelector:#ledr
Icon flushCachedIcons
|
-
ledu
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
usage example(s):
self ledu inspect
ImageEditor openOnClass:self andSelector:#ledu
Icon flushCachedIcons
|
initialization
-
bitmaps
-
-
initBitmap: symbol
-
queries - plugin
-
aspectSelectors
-
accessing
-
numberOfDigits
-
return the number of digits to display
-
numberOfDigits: n
-
specify the number of digits to display
-
numberScale
-
return the number of post-decimal-point digits
-
numberScale: n
-
define the number of post-decimal-point digits
-
radix
-
return the number radix; for now, only 10 (default)
or 16 are supported
-
radix: something
-
set the number radix; for now, only 10 (default)
or 16 are supported
accessing channels
-
ledColorChannel
-
-
ledColorChannel: aValueHolder
-
accessing-color & font
-
foregroundColor: aColor
-
change the led's color
change & update
-
update: something with: aParameter from: changedObject
-
redraw myself, when the model changes
drawing
-
redrawX: rx y: ry width: rw height: rh
-
update my view
events
-
sizeChanged: how
-
(comment from inherited method)
tell subviews that I changed size.
How is either #smaller, #larger or nil, and is used to control the order,
in which subviews are notified (possibly reducing redraw activity)
initialization
-
fetchDeviceResources
-
fetch device colors, to avoid reallocation at redraw time
-
initialize
-
(comment from inherited method)
must be called if redefined
queries
-
computePreferredExtent
-
(comment from inherited method)
return my computed preferred extent - this is the minimum size I would like to have.
If there are any components, a rectangle enclosing them
is returned. Otherwise, the actual extent is returned.
displaying integers:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := 12345 asValue).
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 1)
]
] fork
|
HEX display (integers only):
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds radix:16.
leds model:(valueHolder := 12345 asValue).
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 1)
]
] fork
|
displaying floats:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := 12345.123 asValue).
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 1)
]
] fork
|
displaying fixedPoint numbers:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := 12345.888 asValue).
leds numberScale:2.
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 0.01)
]
] fork
|
scientific numbers:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := -3.1415e15 asValue).
leds numberOfDigits:12.
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 10000)
]
] fork
|
number too big:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := 9995 asValue).
leds numberScale:2.
leds numberOfDigits:4.
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 1)
]
] fork
|
changing the color (above 100):
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := 95 asValue).
leds numberScale:2.
leds numberOfDigits:4.
leds foregroundColor:Color green.
top openAndWait.
[
[top realized] whileTrue:[
Delay waitForSeconds:1.
valueHolder value:(valueHolder value + 1).
valueHolder value >= 100 ifTrue:[
leds foregroundColor:Color red.
]
]
] fork
|
displaying strings:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := Time now printString asValue).
top openAndWait.
|
displaying strings:
|top leds valueHolder|
top := StandardSystemView extent:200@200.
leds := DigitalLedDisplay origin:0.0@0.0 corner:1.0@30 in:top.
leds model:(valueHolder := 12345 asValue).
top openAndWait.
[
[:exit |
#('AAAAA'
'bbbbb'
'CCCCC'
'ddddd'
'EEEEE'
'FFFFF'
'uuuuu'
'PPPPP'
'rrrrr'
'ooooo'
) do:[:s |
top realized ifFalse:[exit value:nil].
valueHolder value:s.
Delay waitForSeconds:1.
]
] loopWithExit.
] fork
|
|