This method retrieves the widget state.
Returns the widget state. This may be WIDGETSTATE_SELECTED, WIDGETSTATE_UNSELECTED, or WIDGETSTATE_INDETERMINATE.
local displays = GetDisplays()
local window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[1])
local ui = CreateInterface(window)
local sz = ui.background:ClientSize()
local button = CreateButton("Unselected", sz.x / 2 - 40, sz.y / 2 - 15, 120, 30, ui.background, BUTTON_CHECKBOX)
while true do
local ev = WaitEvent()
if ev.id == EVENT_WIDGETACTION then
if ev.source == button then
if button:GetState() == WIDGETSTATE_SELECTED then
button:SetText("Selected")
else
button:SetText("Unselected")
end
end
elseif ev.id == EVENT_WINDOWCLOSE then
return 0
end
end