From 9196e5d1ec546e73c7d78a809292436a84de233b Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 11 Sep 2011 04:23:35 +0000 Subject: [PATCH] Input Config - auto focus when drop down menus change --- .../config/InputConfig.Designer.cs | 1 + BizHawk.MultiClient/config/InputConfig.cs | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/BizHawk.MultiClient/config/InputConfig.Designer.cs b/BizHawk.MultiClient/config/InputConfig.Designer.cs index bb67f032e0..9c54df0e02 100644 --- a/BizHawk.MultiClient/config/InputConfig.Designer.cs +++ b/BizHawk.MultiClient/config/InputConfig.Designer.cs @@ -192,6 +192,7 @@ this.Controls.Add(this.ButtonsGroupBox); this.Controls.Add(this.Cancel); this.Controls.Add(this.OK); + this.DoubleBuffered = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; diff --git a/BizHawk.MultiClient/config/InputConfig.cs b/BizHawk.MultiClient/config/InputConfig.cs index a5650cc779..4ef4de771f 100644 --- a/BizHawk.MultiClient/config/InputConfig.cs +++ b/BizHawk.MultiClient/config/InputConfig.cs @@ -116,6 +116,7 @@ namespace BizHawk.MultiClient } Changed = true; } + private void UpdateSMS(int prev) { ButtonsGroupBox.Controls.Clear(); @@ -183,6 +184,7 @@ namespace BizHawk.MultiClient TempLabel.Dispose(); } } + private void DoPCE() { Label TempLabel; @@ -234,6 +236,7 @@ namespace BizHawk.MultiClient } Changed = true; } + private void UpdatePCE(int prev) { ButtonsGroupBox.Controls.Clear(); @@ -303,6 +306,7 @@ namespace BizHawk.MultiClient TempLabel.Dispose(); } } + private void DoGen() { this.Text = ControllerStr + "Sega Genesis"; @@ -581,7 +585,6 @@ namespace BizHawk.MultiClient TempLabel.Dispose(); } IDX_CONTROLLERENABLED.Enabled = true; - } private void DoGameBoy() @@ -618,6 +621,7 @@ namespace BizHawk.MultiClient } Changed = true; } + private void UpdateGameBoy() { ButtonsGroupBox.Controls.Clear(); @@ -709,6 +713,7 @@ namespace BizHawk.MultiClient } Changed = true; } + private void UpdateNES(int prev) { ButtonsGroupBox.Controls.Clear(); @@ -780,6 +785,7 @@ namespace BizHawk.MultiClient TempLabel.Dispose(); } } + private void InputConfig_Load(object sender, EventArgs e) { AutoTab.Checked = Global.Config.InputConfigAutoTab; @@ -789,6 +795,7 @@ namespace BizHawk.MultiClient AllowLR.Checked = Global.Config.AllowUD_LR; if (Global.Game != null) + { switch (Global.Game.System) { case "SMS": @@ -809,7 +816,6 @@ namespace BizHawk.MultiClient case "TI83": this.SystemComboBox.SelectedIndex = SystemComboBox.Items.IndexOf("TI-83"); break; - case "NES": this.SystemComboBox.SelectedIndex = SystemComboBox.Items.IndexOf("NES"); break; @@ -817,7 +823,9 @@ namespace BizHawk.MultiClient this.SystemComboBox.SelectedIndex = 0; break; } + } } + private void OK_Click(object sender, EventArgs e) { if (Changed) @@ -889,6 +897,7 @@ namespace BizHawk.MultiClient ControllComboBox.SelectedIndex = 0; CurSelectConsole = this.SystemComboBox.SelectedItem.ToString(); CurSelectController = 0; + SetFocus(); } private void ControllComboBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -918,6 +927,7 @@ namespace BizHawk.MultiClient break; } CurSelectController = ControllComboBox.SelectedIndex; + SetFocus(); } private void UpdateAll() { @@ -951,6 +961,18 @@ namespace BizHawk.MultiClient SetAutoTab(); } + private void SetFocus() + { + for (int x = 0; x < ButtonsGroupBox.Controls.Count; x++) + { + if (ButtonsGroupBox.Controls[x] is InputWidget) + { + ButtonsGroupBox.Controls[x].Focus(); + return; + } + } + } + private void SetAutoTab() { for (int x = 0; x < ButtonsGroupBox.Controls.Count; x++)