https://github.com/libsdl-org/Maelstrom/commit/fbb999544778e9cac0bc40c23130545d77bb7e3a
From fbb999544778e9cac0bc40c23130545d77bb7e3a Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 24 Oct 2012 23:27:18 -0700
Subject: [PATCH] Fixed showing and hiding the iOS keyboard when we're not in
fast iteration mode.
---
screenlib/UIPanel.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/screenlib/UIPanel.cpp b/screenlib/UIPanel.cpp
index d59f6dbd..b1965c08 100644
--- a/screenlib/UIPanel.cpp
+++ b/screenlib/UIPanel.cpp
@@ -23,6 +23,7 @@
#include "UIPanel.h"
#include "UIManager.h"
#include "UIElement.h"
+#include "UIElementEditbox.h"
#include "UITemplates.h"
UIElementType UIPanel::s_elementType;
@@ -97,6 +98,12 @@ UIPanel::Show()
UIBaseElement::Show();
+ // Give the first editbox focus
+ UIElementEditbox *editbox = FindElement<UIElementEditbox>();
+ if (editbox) {
+ editbox->SetFocus(true);
+ }
+
if (m_delegate) {
m_delegate->OnShow();
}
@@ -111,6 +118,13 @@ UIPanel::Hide()
UIBaseElement::Hide();
+ // Clear focus on editboxes
+ array<UIElementEditbox*> editboxes;
+ FindElements<UIElementEditbox>(editboxes);
+ for (int i = 0; i < editboxes.length(); ++i) {
+ editboxes[i]->SetFocus(false);
+ }
+
// Save data to preferences
if (ShouldSaveData()) {
Prefs *prefs = GetUI()->GetPrefs();