Wheel IDE

Online demo »

SelectButton

SelectButton example

This example shows how to use the selectButton component.

Code

#project "SelectButton example"

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

#define SELECT_BUTTON_SELECT_BUTTON 0xF121D096
#define SELECT_BUTTON_STATUS_LIGHT  0x8FBC7C0A

#resource "selectButton.wfrm"

number buttonToColor[3] = [COMPONENT_COLOR_RED, COMPONENT_COLOR_GREEN, COMPONENT_COLOR_BLUE]

; @proc                   SelectButton onChange event.
; @param windowHandle     The handle to the active window.
; @param value            New active button.
proc onSelectButtonSelectButtonChange(number windowHandle, number value)
    components.statusLight.setColor(windowHandle, SELECT_BUTTON_STATUS_LIGHT, buttonToColor[value])
end

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

proc main()
    showSelectButtonForm()
    halt()
end

Screenshot