xtd 0.2.0
toggle_button.cpp

demonstrates the use of xtd::forms::toggle_button control.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/toggle_button>
using namespace xtd;
using namespace xtd::forms;
namespace toggle_button_example {
class form1 : public form {
public:
form1() {
text("Toggle button example");
controls().push_back_range({toggle_button1, toggle_button2, toggle_button3});
toggle_button1.auto_check(false);
toggle_button1.click += [&] {
//toggle_button1.checked(!toggle_button1.checked());
toggle_button1.text(string::format("{}", toggle_button1.check_state()));
};
toggle_button1.location({30, 30});
toggle_button1.text(string::format("{}", toggle_button1.check_state()));
toggle_button1.width(120);
toggle_button2.check_state_changed += [&] {
toggle_button2.text(string::format("{}", toggle_button2.check_state()));
};
toggle_button2.checked(true);
toggle_button2.location({30, 80});
toggle_button2.width(120);
toggle_button3.check_state_changed += [&] {
toggle_button3.text(string::format("{}", toggle_button3.check_state()));
};
toggle_button3.check_state(forms::check_state::indeterminate);
toggle_button3.three_state(true);
toggle_button3.location({30, 130});
toggle_button3.width(120);
}
private:
toggle_button toggle_button1;
toggle_button toggle_button2;
toggle_button toggle_button3;
};
}
auto main() -> int {
application::run(toggle_button_example::form1 {});
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
static void enable_visual_styles()
Enables visual styles for the application.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a Windows toggle_button.
Definition toggle_button.hpp:44
@ indeterminate
The control is indeterminate. An indeterminate control generally has a shaded appearance.
Definition check_state.hpp:29
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8