From 780d9a7e9375e4af9b4074142058c626b3ba46e4 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 14 Aug 2023 09:50:35 +0800 Subject: [PATCH] FIX: add cursor and enter processing for plate name github:https://github.com/bambulab/BambuStudio/issues/2262#event-10081065971 jira:https://jira.bambooolab.com/browse/STUDIO-3992 Change-Id: Ie6120a8ff99f9568f9e42800429a1c5b378fc28f (cherry picked from commit dbfc17943fa912470f26de1615088c87bd022b4e) --- src/slic3r/GUI/PlateSettingsDialog.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/PlateSettingsDialog.cpp b/src/slic3r/GUI/PlateSettingsDialog.cpp index 9a0ffcec18..3f5030616f 100644 --- a/src/slic3r/GUI/PlateSettingsDialog.cpp +++ b/src/slic3r/GUI/PlateSettingsDialog.cpp @@ -224,6 +224,12 @@ PlateNameEditDialog::PlateNameEditDialog(wxWindow *parent, wxWindowID id, const auto plate_name_txt = new wxStaticText(this, wxID_ANY, _L("Plate name")); plate_name_txt->SetFont(Label::Body_14); m_ti_plate_name = new TextInput(this, wxString::FromDouble(0.0), "", "", wxDefaultPosition, wxSize(FromDIP(240), -1), wxTE_PROCESS_ENTER); + m_ti_plate_name->Bind(wxEVT_TEXT_ENTER, [this](wxCommandEvent &e) { + if (this->IsModal()) + EndModal(wxID_YES); + else + this->Close(); + }); top_sizer->Add(plate_name_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); top_sizer->Add(m_ti_plate_name, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5)); m_ti_plate_name->GetTextCtrl()->SetMaxLength(250); @@ -293,6 +299,10 @@ void PlateNameEditDialog::on_dpi_changed(const wxRect &suggested_rect) wxString PlateNameEditDialog::get_plate_name() const { return m_ti_plate_name->GetTextCtrl()->GetValue(); } -void PlateNameEditDialog::set_plate_name(const wxString &name) { m_ti_plate_name->GetTextCtrl()->SetValue(name); } +void PlateNameEditDialog::set_plate_name(const wxString &name) { + m_ti_plate_name->GetTextCtrl()->SetValue(name); + m_ti_plate_name->GetTextCtrl()->SetFocus(); + m_ti_plate_name->GetTextCtrl()->SetInsertionPointEnd(); +} }} // namespace Slic3r::GUI \ No newline at end of file