From 7c512a3f7e766be00d364a65bc48969b6f2240f7 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Mon, 21 Feb 2011 14:36:19 +0000 Subject: [PATCH] Ram Watch - New Watch - input validation on Address box --- .../tools/RamWatchNewWatch.Designer.cs | 6 +++++- BizHawk.MultiClient/tools/RamWatchNewWatch.cs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/tools/RamWatchNewWatch.Designer.cs b/BizHawk.MultiClient/tools/RamWatchNewWatch.Designer.cs index c86e316453..b810e16115 100644 --- a/BizHawk.MultiClient/tools/RamWatchNewWatch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamWatchNewWatch.Designer.cs @@ -71,15 +71,19 @@ // // AddressBox // + this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.AddressBox.Location = new System.Drawing.Point(69, 6); + this.AddressBox.MaxLength = 8; this.AddressBox.Name = "AddressBox"; this.AddressBox.Size = new System.Drawing.Size(100, 20); this.AddressBox.TabIndex = 2; - this.AddressBox.Text = "0000"; + this.AddressBox.Text = "00000000"; + this.AddressBox.Leave += new System.EventHandler(this.AddressBox_Leave); // // NotesBox // this.NotesBox.Location = new System.Drawing.Point(69, 32); + this.NotesBox.MaxLength = 256; this.NotesBox.Name = "NotesBox"; this.NotesBox.Size = new System.Drawing.Size(100, 20); this.NotesBox.TabIndex = 3; diff --git a/BizHawk.MultiClient/tools/RamWatchNewWatch.cs b/BizHawk.MultiClient/tools/RamWatchNewWatch.cs index cce2ca627a..68ec1d1673 100644 --- a/BizHawk.MultiClient/tools/RamWatchNewWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatchNewWatch.cs @@ -137,5 +137,17 @@ namespace BizHawk.MultiClient this.Close(); } + + private void AddressBox_Leave(object sender, EventArgs e) + { + AddressBox.Text = AddressBox.Text.Replace(" ", ""); + if (!InputValidate.IsValidHexNumber(AddressBox.Text)) + { + AddressBox.Focus(); + AddressBox.SelectAll(); + ToolTip t = new ToolTip(); + t.Show("MUst be a valid hexadecimal vaue", AddressBox, 5000); + } + } } }