From eadcc5eadd2bd4c0c292c0e7f8b75cff9aaa129f Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 9 Jun 2016 15:39:00 +0200 Subject: [PATCH] Keyboard focus fixed --- EAPMethods/include/EAP_UI.h | 5 +++++ EAPMethods/src/EAP_UI.cpp | 11 +++++++---- EAPMethods/src/TTLS_UI.cpp | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/EAPMethods/include/EAP_UI.h b/EAPMethods/include/EAP_UI.h index 8512039..855c1cf 100644 --- a/EAPMethods/include/EAP_UI.h +++ b/EAPMethods/include/EAP_UI.h @@ -231,6 +231,11 @@ public: /// Constructs a banner pannel and set the title text to product name /// wxEAPBannerPanel(wxWindow* parent); + +protected: + /// \cond internal + virtual bool AcceptsFocusFromKeyboard() const { return false; } + /// \endcond }; diff --git a/EAPMethods/src/EAP_UI.cpp b/EAPMethods/src/EAP_UI.cpp index cb79c22..2015d42 100644 --- a/EAPMethods/src/EAP_UI.cpp +++ b/EAPMethods/src/EAP_UI.cpp @@ -36,11 +36,14 @@ wxEAPCredentialsDialog::wxEAPCredentialsDialog(wxWindow* parent) : wxEAPCredenti void wxEAPCredentialsDialog::AddContents(wxPanel **contents, size_t content_count) { - for (size_t i = 0; i < content_count; i++) - m_panels->Add(contents[i], 0, wxALL|wxEXPAND, 5); + if (content_count) { + for (size_t i = 0; i < content_count; i++) + m_panels->Add(contents[i], 0, wxALL|wxEXPAND, 5); - this->Layout(); - this->GetSizer()->Fit(this); + this->Layout(); + this->GetSizer()->Fit(this); + contents[0]->SetFocusFromKbd(); + } } diff --git a/EAPMethods/src/TTLS_UI.cpp b/EAPMethods/src/TTLS_UI.cpp index c9695b0..e1e4615 100644 --- a/EAPMethods/src/TTLS_UI.cpp +++ b/EAPMethods/src/TTLS_UI.cpp @@ -204,6 +204,8 @@ wxEAPTTLSConfig::wxEAPTTLSConfig(eap::config_ttls &cfg, LPCTSTR pszCredTarget, w this->SetSizer(sb_content); this->Layout(); + m_outer_identity->SetFocusFromKbd(); + // Connect Events this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPTTLSConfig::OnInitDialog)); }