xtd 0.2.0
Loading...
Searching...
No Matches
enable_changed_event.cpp

demonstrates the use of idle event.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/message_box>
#include <xtd/forms/radio_button>
using namespace xtd;
using namespace xtd::forms;
namespace enable_changed_event_example {
class form1 : public form {
public:
form1() {
radio_button1.location({0, 0});
radio_button1.name("radio_button1");
radio_button1.size({100, 17});
radio_button1.text("button1");
radio_button1.enabled_changed += event_handler(*this, &form1::radio_button1_enabled_changed);
radio_button2.location({0, 39});
radio_button2.name("radio_button2");
radio_button2.size({150, 17});
radio_button2.text("Disable button1");
radio_button2.checked_changed += event_handler(*this, &form1::radio_button2_checked_changed);
client_size({292, 273});
controls().push_back_range({radio_button1, radio_button2});
name("Form1");
}
private:
void radio_button1_enabled_changed(object& sender, const event_args& e) {
message_box::show("This button has been disabled.");
}
void radio_button2_checked_changed(object& sender, const event_args& e) {
radio_button1.enabled(false);
}
radio_button radio_button1;
radio_button radio_button2;
};
}
auto main() -> int {
application::run(enable_changed_event_example::form1 {});
}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Enables the user to select a single option from a group of choices when paired with other xtd::forms:...
Definition radio_button.h:40
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:32
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10