Make Enter on a name edit accept the dialog

pull/303/head
scrawl 7 years ago
parent 843106fc61
commit 8ae7e4c958

@ -54,9 +54,16 @@ namespace MWGui
mCreateButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCreateButtonClicked);
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCancelButtonClicked);
mNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &AlchemyWindow::onAccept);
center();
}
void AlchemyWindow::onAccept(MyGUI::EditBox* sender)
{
onCreateButtonClicked(sender);
}
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
@ -128,6 +135,8 @@ namespace MWGui
}
update();
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit);
}
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* _sender)

@ -44,6 +44,7 @@ namespace MWGui
void onCancelButtonClicked(MyGUI::Widget* _sender);
void onCreateButtonClicked(MyGUI::Widget* _sender);
void onIngredientSelected(MyGUI::Widget* _sender);
void onAccept(MyGUI::EditBox*);
void onSelectedItem(int index);

@ -4,6 +4,7 @@
#include <MyGUI_Button.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_EditBox.h>
#include <components/widgets/list.hpp>
#include <components/settings/settings.hpp>
@ -53,6 +54,7 @@ namespace MWGui
mSoulBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectSoul);
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onBuyButtonClicked);
mTypeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onTypeButtonClicked);
mName->eventEditSelectAccept += MyGUI::newDelegate(this, &EnchantingDialog::onAccept);
}
EnchantingDialog::~EnchantingDialog()
@ -63,6 +65,7 @@ namespace MWGui
void EnchantingDialog::onOpen()
{
center();
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mName);
}
void EnchantingDialog::setSoulGem(const MWWorld::Ptr &gem)
@ -284,6 +287,11 @@ namespace MWGui
updateEffectsView();
}
void EnchantingDialog::onAccept(MyGUI::EditBox *sender)
{
onBuyButtonClicked(sender);
}
void EnchantingDialog::onBuyButtonClicked(MyGUI::Widget* sender)
{
if (mEffects.size() <= 0)

@ -48,6 +48,7 @@ namespace MWGui
void onBuyButtonClicked(MyGUI::Widget* sender);
void updateLabels();
void onTypeButtonClicked(MyGUI::Widget* sender);
void onAccept(MyGUI::EditBox* sender);
ItemSelectionDialog* mItemSelectionDialog;
@ -60,7 +61,7 @@ namespace MWGui
MyGUI::Button* mTypeButton;
MyGUI::Button* mBuyButton;
MyGUI::TextBox* mName;
MyGUI::EditBox* mName;
MyGUI::TextBox* mEnchantmentPoints;
MyGUI::TextBox* mCastCost;
MyGUI::TextBox* mCharge;

@ -349,6 +349,7 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onCancelButtonClicked);
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onBuyButtonClicked);
mNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SpellCreationDialog::onAccept);
setWidgets(mAvailableEffectsList, mUsedEffectsView);
}
@ -416,6 +417,11 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_SpellCreation);
}
void SpellCreationDialog::onAccept(MyGUI::EditBox *sender)
{
onBuyButtonClicked(sender);
}
void SpellCreationDialog::onOpen()
{
center();

@ -162,6 +162,7 @@ namespace MWGui
void onCancelButtonClicked (MyGUI::Widget* sender);
void onBuyButtonClicked (MyGUI::Widget* sender);
void onAccept(MyGUI::EditBox* sender);
virtual void notifyEffectsChanged ();

Loading…
Cancel
Save