diff UI/EquipmentAmountControl.cs @ 43:7ace7d2249ac

Fixes #117: Add percentage and number boxes to equipment item dialogs * Add value changing when changing radio button selection * Add logic to equipment amount editing control to perform value setting (but see #146) Also, fixes #114 by rebuilding everything in to a single control
author IBBoard <dev@ibboard.co.uk>
date Mon, 07 Sep 2009 20:10:40 +0000
parents d06c2e390a14
children 712915de47fd
line wrap: on
line diff
--- a/UI/EquipmentAmountControl.cs	Sun Sep 06 19:58:39 2009 +0000
+++ b/UI/EquipmentAmountControl.cs	Mon Sep 07 20:10:40 2009 +0000
@@ -125,13 +125,13 @@
 				percentage.Value = 100;
 			}
 
-			OnValueChanged();
+			radioCheckedChanged(sender, e);
 		}
 
 		private void percentage_ValueChanged(object sender, EventArgs e)
 		{
 			SetNumericValueFromPercentage();
-			rbEquipAll.Checked = (percentage.Value == 100);
+			rbEquipAll.Checked = (percentage.Value == 100 && !rbNumeric.Checked);
 			OnValueChanged();
 		}
 
@@ -184,9 +184,9 @@
 				{
 					val = (double) numeric.Value;
 				}
-				else if (rbPercentage.Enabled)
+				else if (rbPercentage.Checked)
 				{
-					val = (double) percentage.Value / 100.0;
+					val = (double) percentage.Value;
 				}
 				else if (rbEquipAll.Checked)
 				{
@@ -224,5 +224,10 @@
 				numeric.Value = (int)equipAmountNum;
 			}
 		}
+
+		private void radioCheckedChanged(object sender, EventArgs e)
+		{
+			OnValueChanged();
+		}
 	}
 }