Added wxEVT_TEXT_ENTER handling for TextCtrl, SpinCtrl & PointCtrl (but it doesn't work under OSX) (fix of #1518)

This commit is contained in:
YuSanka 2019-01-08 16:05:49 +01:00
parent 2ccdfe6853
commit 6efcdd1ddf
2 changed files with 72 additions and 37 deletions

View file

@ -74,7 +74,7 @@ protected:
/// Call the attached on_kill_focus method.
//! It's important to use wxEvent instead of wxFocusEvent,
//! in another case we can't unfocused control at all
void on_kill_focus(wxEvent& event);
void on_kill_focus();
/// Call the attached on_change method.
void on_set_focus(wxEvent& event);
/// Call the attached on_change method.
@ -226,6 +226,8 @@ protected:
// current value
boost::any m_value;
bool bEnterPressed = false;
friend class OptionsGroup;
};
@ -252,6 +254,8 @@ public:
~TextCtrl() {}
void BUILD();
// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
void propagate_value();
wxWindow* window {nullptr};
virtual void set_value(const std::string& value, bool change_event = false) {
@ -310,6 +314,8 @@ public:
wxWindow* window{ nullptr };
void BUILD() override;
/// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
void propagate_value() ;
void set_value(const std::string& value, bool change_event = false) {
m_disable_change_event = !change_event;
@ -393,8 +399,8 @@ public:
wxTextCtrl* y_textctrl{ nullptr };
void BUILD() override;
void OnKillFocus(wxEvent& e, wxTextCtrl* win);
// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
void propagate_value(wxTextCtrl* win);
void set_value(const Vec2d& value, bool change_event = false);
void set_value(const boost::any& value, bool change_event = false);
boost::any& get_value() override;