eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'DigitalClockView':

Home

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

Class: DigitalClockView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--DigitalClockView

Package:
stx:libwidg3
Category:
Views-Misc
Version:
rev: 1.26 date: 2023/07/06 14:34:52
user: cg
file: DigitalClockView.st directory: libwidg3
module: stx stc-classLibrary: libwidg3

Description:


another clock replacement ...
This is a regular view - it can also be placed into another one.

copyright

COPYRIGHT (c) 1997 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.

Class protocol:

startup
o  isVisualStartable
yes, I can be started via double click in the browser

o  open
open a topView containing a digitalClock

Usage example(s):

     DigitalClockView open


Instance protocol:

accessing
o  model: aValueHolder

o  showMillis: aBoolean

o  showSeconds: aBoolean

o  timeHolder: aValueHolder
if set, this provides the time;
otherwise I will be a free running clock

drawing
o  redraw
update my view

o  showTime: whichTime
executed every second (by timedBlock)

o  updateTime
executed every second (by timedBlock)

events
o  destroy
the view was destroyed - remove time-scheduled updateBlock

o  mapped
view was mapped - launch a time-scheduled updateBlock

o  sizeChanged: how from: oldExtentOrNil
my view has changed the size (not the contents)

o  update: aspect with: parameter from: changedObject
(comment from inherited method)
an update request

initialization
o  fetchDeviceResources
fetch device colors, to avoid reallocation at redraw time

o  initialize
DigitalClockView new open

o  startClock
launch a time-scheduled updateBlock

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:


clock in a topView:
 |top clk prefSize|

 top := StandardSystemView new.
 top label:'ST/X clock'.

 clk := DigitalClockView in:top.
 prefSize := clk preferredExtent.
 top extent:prefSize.
 top minExtent:prefSize.
 top maxExtent:prefSize.

 top open
clock as a component:
 |top frame clk fileList sz|

 top := StandardSystemView new.
 top extent:200@200.

 clk := DigitalClockView new.
 clk showSeconds:false.
 sz := clk preferredExtent.

 frame := View origin:1.0@0.0 corner:1.0@(sz y) in:top.
 frame leftInset:(sz x negated - 4); rightInset:4; topInset:2; bottomInset:-2.
 frame level:-1.

 clk := DigitalClockView in:frame.

 fileList := ScrollableView for:FileSelectionList in:top.
 fileList origin:0@50 corner:1.0@1.0. 

 top open
time via an external valueholder:
 |top frame clk fileList sz timeHolder startTime|

 startTime := Time nowWithMilliseconds.
 timeHolder := startTime asValue.

 top := StandardSystemView new.
 top windowTitle:'Stopwatch'.
 top extent:200@200.

 clk := DigitalClockView new.
 clk showMillis:true.
 clk timeHolder:timeHolder.
 sz := clk preferredExtent.

 frame := View origin:1.0@0.0 corner:1.0@(sz y) in:top.
 frame leftInset:(sz x negated - 4); rightInset:4; topInset:2; bottomInset:-2.
 frame level:-1.

 frame addComponent:clk.

 fileList := ScrollableView for:FileSelectionList in:top.
 fileList origin:0@50 corner:1.0@1.0. 

 top openAndWaitUntilVisible.

 [top isOpen] whileTrue:[
     timeHolder value:(Time nowWithMilliseconds - startTime).
     Delay waitForSeconds:0.05.
 ].


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 17:24:40 GMT