This is the most basic example of a uil app
int WinMain(HINSTANCE, HINSTANCE, LPSTR, int){
uil::Form oForm;
oForm.Run();
}

struct MyForm : uil::Form{
MyForm(){}
};
struct MyForm : uil::Form{
MyForm(){}
uil::Button oButton;
};
Controls require a parent so the form is passed into the constructor.
struct MyForm : uil::Form{
MyForm() : oButton(this){}
uil::Button oButton;
};
struct MyForm : uil::Form{
MyForm() : oButton(this){
oButton.Text(_T("Click Me"));
oButton.Move(50, 50, 100, 20);
}
uil::Button oButton;
};
Here a Lambda is connected to the button's click event that changes the button's text.
struct MyForm : uil::Form{
MyForm() : oButton(this){
oButton.Text(_T("Click Me"));
oButton.Move(50, 50, 100, 20);
oButton.ClickEvent.Connect( [ this ] ( ) {
oButton.Text(_T("Clicked!"));
});
}
uil::Button oButton;
};
The app's WinMain has changed only slightly
int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int){
MyForm oForm;
oForm.Run();
return 0;
}
