guiConfirmRegistration: Set focus to text field (#8761)
authorANAND <ClobberXD@gmail.com>
Wed, 7 Aug 2019 17:15:46 +0000 (22:45 +0530)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Wed, 7 Aug 2019 17:15:46 +0000 (19:15 +0200)
src/gui/guiConfirmRegistration.cpp

index 65c062aa59a2aebaeecdb4e9945d34e2d75ebdf8..6fe2a4fc4cdf4793935ec472dc55d42f5b97155e 100644 (file)
@@ -62,6 +62,7 @@ void GUIConfirmRegistration::removeChildren()
        for (gui::IGUIElement *i : children_copy)
                i->remove();
 }
+
 void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
 {
        acceptInput();
@@ -119,6 +120,7 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
                gui::IGUIEditBox *e = Environment->addEditBox(m_pass_confirm.c_str(),
                                rect2, true, this, ID_confirmPassword);
                e->setPasswordBox(true);
+               Environment->setFocus(e);
        }
 
        ypos += 60 * s;
@@ -218,8 +220,7 @@ bool GUIConfirmRegistration::OnEvent(const SEvent &event)
 
        if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST && isVisible()) {
                if (!canTakeFocus(event.GUIEvent.Element)) {
-                       dstream << "GUIConfirmRegistration: Not allowing focus "
-                                  "change."
+                       dstream << "GUIConfirmRegistration: Not allowing focus change."
                                << std::endl;
                        // Returning true disables focus change
                        return true;