demonstrates some events received by form.
#define TRACE
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/trace_form>
#include <xtd/ctrace>
class form1 :
public form {
public:
form1() {
text("Key events example");
control1.dock(dock_style::fill);
control1.parent(*this);
ctrace << string::format("key_down={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << environment::new_line;
};
ctrace << string::format("key_press={{key_char={}}}", e.key_char() == 0 ? "[none]" : string::format("'{}'", e.key_char())) << environment::new_line;
};
ctrace << string::format("key_up={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << environment::new_line;
if (e.modifiers() == keys::none) ctrace << environment::new_line;
};
}
private:
};
auto main() -> int {
application::run(form1 {});
}
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10