mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-26 08:56:37 +00:00 
			
		
		
		
	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&) |         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)); |         mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(playerGold)); | ||||||
| 
 | 
 | ||||||
|  |         std::string balanceCaption; | ||||||
|         if (mCurrentBalance > 0) |         if (mCurrentBalance > 0) | ||||||
|         { |         { | ||||||
|             mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}"); |             mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}"); | ||||||
|             mTotalBalance->setCaption(boost::lexical_cast<std::string>(mCurrentBalance)); |             balanceCaption = boost::lexical_cast<std::string>(mCurrentBalance); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}"); |             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())); |         mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + boost::lexical_cast<std::string>(getMerchantGold())); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue