From 2b35478e124b469aae73ec7da72516fe8fdbd94f Mon Sep 17 00:00:00 2001 From: tao wang Date: Fri, 13 Jan 2023 14:34:13 +0800 Subject: [PATCH] ENH:Allow clicking to confirm button when the data is complete Change-Id: If28f20e6ce1fac783533cbc595614a909386dfae --- src/slic3r/GUI/MsgDialog.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 8e2525747..0865eee43 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -579,9 +579,23 @@ void InputIpAddressDialog::on_ok(wxMouseEvent& evt) m_tips_note1->Show(); m_tips_note2->Show(); m_tips_note3->Show(); - m_button_ok->Enable(false); - m_button_ok->SetBackgroundColor(wxColour(0x90, 0x90, 0x90)); - m_button_ok->SetBorderColor(wxColour(0x90, 0x90, 0x90)); + + auto str_ip = m_input_ip->GetTextCtrl()->GetValue(); + auto str_access_code = m_input_access_code->GetTextCtrl()->GetValue(); + if (isIp(str_ip.ToStdString()) && str_access_code.Length() == 8) { + m_button_ok->Enable(true); + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); + m_button_ok->SetBorderColor(*wxWHITE); + m_button_ok->SetBackgroundColor(btn_bg_green); + } + else { + m_button_ok->Enable(false); + m_button_ok->SetBackgroundColor(wxColour(0x90, 0x90, 0x90)); + m_button_ok->SetBorderColor(wxColour(0x90, 0x90, 0x90)); + } + + Layout(); Fit(); }