eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'DigitalLedDisplay':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: DigitalLedDisplay


Inheritance:

   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

Description:


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.


Related information:

    DigitalClockView
    Label
    ValueHolder

Class protocol:

image specs
o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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

o  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
o  bitmaps

o  initBitmap: symbol

queries - plugin
o  aspectSelectors


Instance protocol:

accessing
o  numberOfDigits
return the number of digits to display

o  numberOfDigits: n
specify the number of digits to display

o  numberScale
return the number of post-decimal-point digits

o  numberScale: n
define the number of post-decimal-point digits

o  radix
return the number radix; for now, only 10 (default)
or 16 are supported

o  radix: something
set the number radix; for now, only 10 (default)
or 16 are supported

accessing channels
o  ledColorChannel

o  ledColorChannel: aValueHolder

accessing-color & font
o  foregroundColor: aColor
change the led's color

change & update
o  update: something with: aParameter from: changedObject
redraw myself, when the model changes

drawing
o  redrawX: rx y: ry width: rw height: rh
update my view

events
o  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
o  fetchDeviceResources
fetch device colors, to avoid reallocation at redraw time

o  initialize
(comment from inherited method)
must be called if redefined

queries
o  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.


Examples:


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


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 19 Apr 2024 20:08:23 GMT