Hex Editor - fix the Find dialog box behavior, now correctly allows all characters and casings when switching to text mode

This commit is contained in:
adelikat 2014-02-24 03:18:43 +00:00
parent 3cf2ba7afc
commit 186939f157
2 changed files with 22 additions and 4 deletions

View File

@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.FindBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.FindBox = new System.Windows.Forms.TextBox();
this.Find_Prev = new System.Windows.Forms.Button();
this.Find_Next = new System.Windows.Forms.Button();
this.HexRadio = new System.Windows.Forms.RadioButton();
@ -40,7 +40,6 @@
this.FindBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.FindBox.Location = new System.Drawing.Point(13, 12);
this.FindBox.Name = "FindBox";
this.FindBox.Nullable = true;
this.FindBox.Size = new System.Drawing.Size(156, 20);
this.FindBox.TabIndex = 0;
this.FindBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FindBox_KeyDown);
@ -112,7 +111,7 @@
#endregion
private HexTextBox FindBox;
private System.Windows.Forms.TextBox FindBox;
private System.Windows.Forms.Button Find_Prev;
private System.Windows.Forms.Button Find_Next;
private System.Windows.Forms.RadioButton HexRadio;

View File

@ -13,6 +13,7 @@ namespace BizHawk.Client.EmuHawk
public HexFind()
{
InitializeComponent();
ChangeCasing();
}
public void SetInitialValue(string value)
@ -66,7 +67,25 @@ namespace BizHawk.Client.EmuHawk
private void ChangeCasing()
{
FindBox.CharacterCasing = HexRadio.Checked ? CharacterCasing.Upper : CharacterCasing.Normal;
var text = FindBox.Text;
var location = FindBox.Location;
var size = FindBox.Size;
Controls.Remove(FindBox);
if (HexRadio.Checked)
{
FindBox = new HexTextBox { CharacterCasing = CharacterCasing.Upper };
(FindBox as HexTextBox).Nullable = true;
}
else
{
FindBox = new TextBox { CharacterCasing = CharacterCasing.Normal };
}
FindBox.Text = text;
FindBox.Size = size;
Controls.Add(FindBox);
FindBox.Location = location;
}
private void HexRadio_CheckedChanged(object sender, EventArgs e)