forked from mirror/openmw-tes3mp
Ignore invalid input in numeric EditBox (Fixes #1885)
This commit is contained in:
parent
f3f869e99a
commit
07d827c907
1 changed files with 9 additions and 2 deletions
|
@ -436,6 +436,10 @@ namespace MWGui
|
|||
}
|
||||
catch (std::bad_cast&)
|
||||
{
|
||||
if (_sender->getCaption().empty())
|
||||
mTotalBalance->setCaption("0");
|
||||
else
|
||||
mTotalBalance->setCaption(boost::lexical_cast<std::string>(std::abs(mCurrentBalance)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,16 +464,19 @@ namespace MWGui
|
|||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(playerGold));
|
||||
|
||||
std::string balanceCaption;
|
||||
if (mCurrentBalance > 0)
|
||||
{
|
||||
mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}");
|
||||
mTotalBalance->setCaption(boost::lexical_cast<std::string>(mCurrentBalance));
|
||||
balanceCaption = boost::lexical_cast<std::string>(mCurrentBalance);
|
||||
}
|
||||
else
|
||||
{
|
||||
mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}");
|
||||
mTotalBalance->setCaption(boost::lexical_cast<std::string>(-mCurrentBalance));
|
||||
balanceCaption = boost::lexical_cast<std::string>(-mCurrentBalance);
|
||||
}
|
||||
if (balanceCaption != mTotalBalance->getCaption().asUTF8()) // Don't reset text cursor if text doesn't need to be changed
|
||||
mTotalBalance->setCaption(balanceCaption);
|
||||
|
||||
mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + boost::lexical_cast<std::string>(getMerchantGold()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue