ENH: Navigate while enter valid number

jira: [STUDIO-11440]
Change-Id: I01a0b2fdb67b76cbea4c17539951c8d57dc2cd31
This commit is contained in:
xin.zhang 2025-04-09 14:46:16 +08:00 committed by lane.wei
parent 1fd5340417
commit d6b5bbf84b
2 changed files with 12 additions and 15 deletions

View File

@ -79,18 +79,6 @@ bool TempInput::CheckIsValidVal(bool show_warning)
return true; return true;
} }
void TempInput::OnEdit()
{
/*clear previous status*/
ResetWaringDlg();
/*check the value is valid or not*/
if (CheckIsValidVal(true))
{
SetFinish();
}
}
void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString normal_icon, wxString actice_icon, const wxPoint &pos, const wxSize &size, long style) void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString normal_icon, wxString actice_icon, const wxPoint &pos, const wxSize &size, long style)
{ {
StaticBox::Create(parent, wxID_ANY, pos, size, style); StaticBox::Create(parent, wxID_ANY, pos, size, style);
@ -132,7 +120,18 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
{ {
if (!m_on_changing) /*the wxCUSTOMEVT_SET_TEMP_FINISH event may popup a dialog, which may generate dead loop*/ if (!m_on_changing) /*the wxCUSTOMEVT_SET_TEMP_FINISH event may popup a dialog, which may generate dead loop*/
{ {
OnEdit(); /*clear previous status*/
ResetWaringDlg();
/*check the value is valid or not*/
if (CheckIsValidVal(true))
{
SetFinish();
SetOnChanging();// filter in wxEVT_KILL_FOCUS while navigating
text_ctrl->Navigate(); // quit edit mode
ReSetOnChanging();
}
} }
}); });
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu

View File

@ -127,8 +127,6 @@ public:
void ReSetOnChanging() { m_on_changing = false; } void ReSetOnChanging() { m_on_changing = false; }
protected: protected:
virtual void OnEdit();
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void DoSetToolTipText(wxString const &tip) override; void DoSetToolTipText(wxString const &tip) override;