diff --git a/Core/Other/FormSettings.cs b/Core/Other/FormSettings.cs index 2b1facb9..7b6a756e 100644 --- a/Core/Other/FormSettings.cs +++ b/Core/Other/FormSettings.cs @@ -105,6 +105,10 @@ private void SelectTab(SettingsTab tab){ tab.Button.BackColor = tab.Button.FlatAppearance.MouseDownBackColor; if (!tab.IsInitialized){ + foreach(Control control in tab.Control.InteractiveControls){ + control.MouseLeave += control_MouseLeave; + } + tab.Control.OnReady(); } @@ -118,6 +122,10 @@ private void SelectTab(SettingsTab tab){ currentTab = tab; } + private void control_MouseLeave(object sender, EventArgs e){ + panelContents.Focus(); + } + private class SettingsTab{ public Button Button { get; } diff --git a/Core/Other/Settings/BaseTabSettings.cs b/Core/Other/Settings/BaseTabSettings.cs index 905d3397..ce232676 100644 --- a/Core/Other/Settings/BaseTabSettings.cs +++ b/Core/Other/Settings/BaseTabSettings.cs @@ -1,10 +1,22 @@ -using System.Windows.Forms; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; using TweetDuck.Configuration; namespace TweetDuck.Core.Other.Settings{ class BaseTabSettings : UserControl{ protected static UserConfig Config => Program.UserConfig; + public IEnumerable<Control> InteractiveControls{ + get{ + foreach(Panel panel in Controls.OfType<Panel>()){ + foreach(Control control in panel.Controls){ + yield return control; + } + } + } + } + public BaseTabSettings(){ Padding = new Padding(6); }