mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 05:51:49 +08:00
FIX: TempInput use attach_child of StateHandler
Change-Id: Id49052e484389e8f88eb021cc25d2127f56369f7
This commit is contained in:
parent
816dae015b
commit
8b1ec73b71
@ -48,25 +48,21 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
|
||||
text_ctrl = new wxTextCtrl(this, wxID_ANY, text, {5, 5}, wxDefaultSize, wxTE_PROCESS_ENTER | wxBORDER_NONE, wxTextValidator(wxFILTER_NUMERIC), wxTextCtrlNameStr);
|
||||
text_ctrl->SetMaxLength(3);
|
||||
state_handler.attach_child(text_ctrl);
|
||||
|
||||
text_ctrl->Bind(wxEVT_SET_FOCUS, [this](auto &e) {
|
||||
e.Skip();
|
||||
if (m_read_only) return;
|
||||
e.SetId(GetId());
|
||||
ProcessEventLocally(e);
|
||||
|
||||
//enter input mode
|
||||
// enter input mode
|
||||
auto temp = text_ctrl->GetValue();
|
||||
if (temp.length() > 0 && temp[0] == (0x5f)) {
|
||||
text_ctrl->SetValue(wxEmptyString);
|
||||
}
|
||||
|
||||
if (wdialog != nullptr) { wdialog->Dismiss(); }
|
||||
});
|
||||
text_ctrl->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {
|
||||
if (m_read_only) { SetCursor(wxCURSOR_ARROW); }
|
||||
});
|
||||
text_ctrl->Bind(wxEVT_KILL_FOCUS, [this](auto &e) {
|
||||
OnEdit();
|
||||
e.SetId(GetId());
|
||||
ProcessEventLocally(e);
|
||||
|
||||
auto temp = text_ctrl->GetValue();
|
||||
if (temp.ToStdString().empty()) {
|
||||
text_ctrl->SetValue(wxString("_"));
|
||||
@ -90,9 +86,6 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
|
||||
});
|
||||
text_ctrl->Bind(wxEVT_TEXT_ENTER, [this](wxCommandEvent &e) {
|
||||
OnEdit();
|
||||
e.SetId(GetId());
|
||||
ProcessEventLocally(e);
|
||||
|
||||
auto temp = text_ctrl->GetValue();
|
||||
if (temp.ToStdString().empty()) return;
|
||||
if (!AllisNum(temp.ToStdString())) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user