This method retrieves the widget state.
Returns the widget state. This may be WIDGETSTATE_SELECTED, WIDGETSTATE_UNSELECTED, or WIDGETSTATE_INDETERMINATE.
#include "UltraEngine.h"
using namespace UltraEngine;
int main(int argc, const char* argv[])
{
//Get the displays
auto displays = GetDisplays();
//Create a window
auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0]);
//Create User Interface
auto ui = CreateInterface(window);
auto sz = ui->root->ClientSize();
auto button = CreateButton("Unselected", sz.x / 2 - 40, sz.y / 2 - 15, 120, 30, ui->root, BUTTON_CHECKBOX);
while (true)
{
const Event ev = WaitEvent();
switch (ev.id)
{
case EVENT_WIDGETACTION:
if (ev.source == button)
{
if (button->GetState() == WIDGETSTATE_SELECTED)
{
button->SetText("Selected");
}
else
{
button->SetText("Unselected");
}
}
break;
case EVENT_WINDOWCLOSE:
return 0;
break;
}
}
return 0;
}