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.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;
};
}
private:
};
auto main() -> int {
}
static xtd::string new_line() noexcept
Gets the newline string defined for this environment.
std::ostream ctrace(nullptr)
Provides an std::ostream for xtd::diagnostics::trace.
@ control
The left or right CTRL modifier key.
Definition console_modifiers.hpp:28
@ e
The E key.
Definition console_key.hpp:96
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