-
-
Notifications
You must be signed in to change notification settings - Fork 54
CheckBox
Otavio edited this page Jul 23, 2021
·
5 revisions
CheckBox is a widget that permits the user to make a binary choice. In other words if the funtion is enabled or disabled (true or false).
When the user checks or unchecks a CheckBox it will return one of 2 states: true
or false
.
You will need to declare a pointer for your widget and to initialize it:
std::shared_ptr<FGUI::CCheckBox> CheckBox;
Now you can start setting up your widget usign the Builder Pattern.
FGUI::CBuilder buildrPattern;
// CheckBox
CheckBox = std::make_shared<FGUI::CCheckBox>();
buildrPattern.Widget(CheckBox).Title("Enable").Font("Tahoma", 12, true).SpawnIn(Container);
NOTE: You can also set the default state of a CheckBox before initializing your menu (See: SetState)
(There's other functions of the builder pattern that you can use when setting up a CheckBox
// this will check if the CheckBox is checked (true)
if (CheckBox->GetState()) {
// do stuff
}
// or
// this will set a custom state for the checkbox if Something is true
// you can do much more, those are just some simple examples
if (Something) {
CheckBox->SetState(true/false);
}
Next you will learn about the ColorPicker Widget.
You can also read the library comments/functions for additional info.