Startsidan  ▸  Texter  ▸  Teknikblogg

Anders Hesselbom

Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.

Numeric values in The Wall

2010-02-18

Edit: This post concerns “The Wall”, a discontinued project.

Please read this first. This post shows how to display text numeric using The Wall.

To register a numeric item, call the RegisterNumericItem function. It takes the same arguments as the RegisterTextItem function, but you might want to set some properties to the numeric item.

In this example, I add one text item and one numeric item. I then use the GetItem function to get a reference to the numeric item, so that I can set some of its properties.

The numeric items have properties for setting the expected range of the numeric value. These properties are called LowAlarmLevel and HighAlarmLevel. In this example, I set the HighAlarmLevel to 20, making the item flash if the Value property holds a value that equals to 20 or is higher.

Since the callback function HandleNumber is called each second (see the first argument in the RegisterNumericItem call) the value property will be out of range after 20 seconds, and the numeric item will start flashing on the screen.

Here is the VBScript code for this (must be located in TheWall.vbs):

'Make full screen on primary screen.
'Exclude this line for windowed mode.
MakeFullscreen 0

'Grey background color.
BackgroundColor = "#666666"

'Register a static text item.
RegisterTextItem 0, "MyStaticText", 1, 1, "#bbccdd", "InitTextItem"

'Register a numeric item with one update per second.
RegisterNumericItem 1, "MyNumericItem", 38, 1, "#00ff00", "HandleNumber"

'Do some initialization of the numeric item. Get a reference...
Dim N
Set N = GetItem("MyNumericItem")

'...set the upper alarm threshold...
N.HighAlarmLevel = 20

'...the number of characters positions I want to display...
N.CharacterCount = 3

'...and the number of decimals I want to display. None.
N.DecimalCount = 0

'The callback for the text item. Called once.
Sub InitTextItem(ByVal Item)
   Item.Value = "An increasing number with alarm at 20:"
End Sub

'The callback for the numeric item. Called once a second.
Sub HandleNumber(ByVal Item)
   Item.Value = (Item.Value + 1)
End Sub

You should see something like this on your screen:

 An increasing number with alarm at 20: 17

Note that the Value property of a text item is a String (as in the InitTextItem callback function) but for a numeric item, the Value property is a Double (as in the HandleNumber callback function).

Categories: Programs

Tags: The Wall

One response to “Numeric values in The Wall”

  1. […] Wall is an intelligent home component that can display and update text items, numeric values and bars. Also, The Wall can react to mouse clicks from a computer mouse or from a touch screen. […]

Leave a Reply

Your email address will not be published. Required fields are marked *



En kopp kaffe!

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Bjud på en kopp kaffe!

Om...

Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.

Hem   |   linktr.ee/hesselbom   |   winsoft.se   |   80tal.se   |   Filmtips