diff options
author | Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> | 2018-05-15 21:13:30 +0700 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-05-15 16:13:30 +0200 |
commit | 2f34797c5c1530e7b165a0ce26818eb291a38414 (patch) | |
tree | 26eb3aa701bcf6fc792c26d4ea6be0432a1f3487 | |
parent | a1598e1b83e28503745165d5749cd21b77e97818 (diff) | |
download | minetest-2f34797c5c1530e7b165a0ce26818eb291a38414.tar.gz minetest-2f34797c5c1530e7b165a0ce26818eb291a38414.tar.bz2 minetest-2f34797c5c1530e7b165a0ce26818eb291a38414.zip |
Don't show Android edit dialog when tapping read-only field (#7337)
* Don't show Android edit dialog when tapping read-only field
From Lua API, "If the name is empty the textarea is readonly."
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 12caf39eb..e522769f7 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -3026,29 +3026,31 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event) core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y)); if ((hovered) && (hovered->getType() == irr::gui::EGUIET_EDIT_BOX)) { bool retval = hovered->OnEvent(event); - if (retval) { + if (retval) Environment->setFocus(hovered); - } - m_JavaDialogFieldName = getNameByID(hovered->getID()); + + std::string field_name = getNameByID(hovered->getID()); + /* read-only field */ + if (field_name.empty()) + return retval; + + m_JavaDialogFieldName = field_name; std::string message = gettext("Enter "); std::string label = wide_to_utf8(getLabelByID(hovered->getID())); - if (label == "") { + if (label.empty()) label = "text"; - } message += gettext(label) + ":"; /* single line text input */ int type = 2; /* multi line text input */ - if (((gui::IGUIEditBox*) hovered)->isMultiLineEnabled()) { + if (((gui::IGUIEditBox*) hovered)->isMultiLineEnabled()) type = 1; - } /* passwords are always single line */ - if (((gui::IGUIEditBox*) hovered)->isPasswordBox()) { + if (((gui::IGUIEditBox*) hovered)->isPasswordBox()) type = 3; - } porting::showInputDialog(gettext("ok"), "", wide_to_utf8(((gui::IGUIEditBox*) hovered)->getText()), |