diff --git a/src/states_screens/dialogs/message_dialog.cpp b/src/states_screens/dialogs/message_dialog.cpp index 988b3b516..b8360a861 100644 --- a/src/states_screens/dialogs/message_dialog.cpp +++ b/src/states_screens/dialogs/message_dialog.cpp @@ -123,23 +123,17 @@ void MessageDialog::loadedFromFile() IconButtonWidget* cancelbtn = getWidget("confirm"); cancelbtn->setText(_("OK")); - cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (m_type == MessageDialog::MESSAGE_DIALOG_YESNO) { IconButtonWidget* cancelbtn = getWidget("cancel"); cancelbtn->setText(_("No")); - if(m_focus_on_cancel) - cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (m_type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL) { // In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok' IconButtonWidget* yesbtn = getWidget("confirm"); yesbtn->setText(_("OK")); - IconButtonWidget* cancelbtn = getWidget("cancel"); - if (m_focus_on_cancel) - cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } } @@ -191,3 +185,14 @@ void MessageDialog::onUpdate(float dt) { if (m_listener != NULL) m_listener->onDialogUpdate(dt); } + + +// ----------------------------------------------------------------------------- +void MessageDialog::init() +{ + if (m_focus_on_cancel) + { + RibbonWidget* ribbon = getWidget("buttons"); + ribbon->select("cancel", PLAYER_ID_GAME_MASTER); + } +} // init diff --git a/src/states_screens/dialogs/message_dialog.hpp b/src/states_screens/dialogs/message_dialog.hpp index 8f76df005..b49f29341 100644 --- a/src/states_screens/dialogs/message_dialog.hpp +++ b/src/states_screens/dialogs/message_dialog.hpp @@ -109,6 +109,7 @@ public: /** Calling this will make sure that the focus is set on the 'cancel' or * 'no'. */ void setFocusCancel() {m_focus_on_cancel = true; } + virtual void init() OVERRIDE; };