#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 {
}
Represents text as a sequence of character units.
Definition basic_string.h:79
The environment class.
Definition environment.h:66
std::ostream ctrace(nullptr)
Provides an std::ostream for xtd::diagnostics::trace.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10