Wheel IDE

Online demo »

StatusLight

StatusLight example

This example shows how to use the status light component.

Code

#project "StatusLight example"

#include "lib/modules/standard.whl"
#include "lib/modules/math.whl"
#include "lib/modules/components/component.whl"
#include "lib/modules/components/form.whl"
#include "lib/modules/components/statusLight.whl"

#define STATUS_LIGHT_STATUS_LIGHT 0x219A30F3

#resource "statusLight.wfrm"

number color     = 0
number colors[3] = [COMPONENT_COLOR_RED, COMPONENT_COLOR_GREEN, COMPONENT_COLOR_BLUE]

; @proc                   Show the form.
; @ret                    The handle to the form.
proc showStatusLightForm()
    ret components.form.show("statusLight.wfrm")
end

proc main()
    number windowHandle = showStatusLightForm()
    repeat
        components.statusLight.setColor(windowHandle, STATUS_LIGHT_STATUS_LIGHT, colors[color])
        color = remainder(color + 1, 3)
        sleep(1000)
    end
end

Screenshot