Startsidan  ▸  Texter  ▸  Teknikblogg

Anders Hesselbom

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

The most basic panel for The Wall


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

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

This is a very simple panel. To run it, place this code in a file called TheWall.vbs, place it next to TheWall.exe and start TheWall.exe. If you are running a single display system, you must delete the first line or change it so that it says MakeFullscreen 0.

'Make full screen on secondary screen (0 = primary screen).
'Exclude this line for windowed mode.
MakeFullscreen 1

'Black background color.
BackgroundColor = "#000000"

'Register three text items.
RegisterTextItem 0, "A", 0, 0, "#00ff00", "CallbackA"
RegisterTextItem 1, "B", 1, 1, "#0000ff", "CallbackB"
RegisterTextItem 2, "C", 2, 2, "#00ffff", "CallbackC"

Sub CallbackA(ByVal Item)
   'For a text item, value (what the item is displaying) is a string.
   Item.Value = "Some green text"
End Sub

Sub CallbackB(ByVal Item)
   Item.Value = "Some blue text"
End Sub

Sub CallbackC(ByVal Item)
   Item.Value = "Some cyan text"
End Sub

This is the result:

Each item you want The Wall to display has two parts: The registration and the callback function. In the example above, the registration is represented by three calls to the RegisterTextItem function, each call for every item. The registration tells The Wall what items it should display, the callback function tells The Wall the value that the item should display. These are the arguments of the RegisterTextItem function:

Parameter 1: UpdateFrequency (32 bit integer) tells how often the text should be updated (that is, how often the callback function will be called) in seconds. 0 means that the item never will be updated. All callback functions are called at startup, and if the UpdateFrequency parameter is greater than 0, it will be called again and again until The Wall is closed. In the example above, CallbackA will be called once, CallbackB will be called each second and CallbackC will be called every two seconds.

Parameter 2: Name (string) is the name of the item for later reference.

Parameter 3 and 4: The X and Y position in characters for the item.

Parameter 5: The color of the item in HTML format.

Parameter 6: The name of the callback procedure. All callback procedures take one object parameter. The type of the object that is passed depend on the type of item you add.

If this program gets to run for 71 seconds, the output will be A=1, B=71 and C=36 because CallbackA is called once at startup, CallbackB is called every second and CallbackC is called each other second (you might need to adjust the first line):

MakeFullscreen 1
BackgroundColor = "#000000"

RegisterTextItem 0, "A", 0, 0, "#00ff00", "CallbackA"
RegisterTextItem 1, "B", 1, 1, "#0000ff", "CallbackB"
RegisterTextItem 2, "C", 2, 2, "#00ffff", "CallbackC"

Dim A
A = 0

Dim B
B = 0

Dim C
C = 0

Sub CallbackA(ByVal Item)
   A = A + 1
   Item.Value = ("A=" & CStr(A))
End Sub

Sub CallbackB(ByVal Item)
   B = B + 1
   Item.Value = ("B=" & CStr(B))
End Sub

Sub CallbackC(ByVal Item)
   C = C + 1
   Item.Value = ("C=" & CStr(C))
End Sub

The reason for using callback functions for collecting the values that should be displayed is that the value might be likely to change. The reason for using VBScript for this is that you might want to display values that The Wall doesn’t know how to collect. Can you grab the value using VBScript, you can feed it to The Wall. No limits!

Categories: Programs

Tags: The Wall

One response to “The most basic panel for 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 […]

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!


Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.

Hem   |   |   |   |   Filmtips