#define TRACE
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/text_box>
#include <xtd/ctrace>
#include <xtd/environment>
namespace numeric_tex_box_example {
class numeric_text_box :
public text_box {
public:
numeric_text_box() = default;
double value() const {
auto result = .0;
return result;
}
protected:
e.handled((!isdigit(
e.key_char()) &&
e.key_char() !=
'.') || (
e.key_char() ==
'.' &&
as<string>(
text()).index_of(
'.') != string::npos));
}
}
}
private:
};
class form1 :
public form {
public:
form1() {
text(
"Numeric text box example");
numeric_text_box1.parent(*this);
numeric_text_box1.value(42);
numeric_text_box1.location({10, 10});
numeric_text_box1.value_changed += [&] {
};
}
private:
numeric_text_box numeric_text_box1;
};
}
auto main() -> int {
}
static xtd::string new_line() noexcept
Gets the newline string defined for this environment.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Represents a standard Windows text box.
Definition text_box.hpp:31
const xtd::string & text() const noexcept override
Gets the text associated with this control.
void on_text_changed(const event_args &e) override
Raises the xtd::forms::control::text_changed event.
std::ostream ctrace(nullptr)
Provides an std::ostream for xtd::diagnostics::trace.
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
bool try_parse(const std::basic_string< char > &str, value_t &value) noexcept
Convert a string into a type.
Definition parse.hpp:416
@ 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
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375