Ban `Control.Focus`
"Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms." --MSDN
This commit is contained in:
parent
2dd87d78f9
commit
8e12e44411
|
@ -9,3 +9,4 @@ M:System.Convert.ToSingle(System.String);use float.{Try,}Parse
|
||||||
M:System.Convert.ToUInt16(System.String);use ushort.{Try,}Parse
|
M:System.Convert.ToUInt16(System.String);use ushort.{Try,}Parse
|
||||||
M:System.Convert.ToUInt32(System.String);use uint.{Try,}Parse
|
M:System.Convert.ToUInt32(System.String);use uint.{Try,}Parse
|
||||||
M:System.Convert.ToUInt64(System.String);use ulong.{Try,}Parse
|
M:System.Convert.ToUInt64(System.String);use ulong.{Try,}Parse
|
||||||
|
M:System.Windows.Forms.Control.Focus;use Activate for Forms, or Select otherwise
|
||||||
|
|
|
@ -228,7 +228,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
switch (m.Msg)
|
switch (m.Msg)
|
||||||
{
|
{
|
||||||
case 0x0201: // WM_LBUTTONDOWN
|
case 0x0201: // WM_LBUTTONDOWN
|
||||||
|
#pragma warning disable RS0030 //TODO is this correct, or should it be `Select()`? --yoshi
|
||||||
Focus();
|
Focus();
|
||||||
|
#pragma warning restore RS0030
|
||||||
return;
|
return;
|
||||||
case 0x0203: // WM_LBUTTONDBLCLK
|
case 0x0203: // WM_LBUTTONDBLCLK
|
||||||
case 0x0204: // WM_RBUTTONDOWN
|
case 0x0204: // WM_RBUTTONDOWN
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_config = config;
|
_config = config;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Icon = Properties.Resources.HotKeysIcon;
|
Icon = Properties.Resources.HotKeysIcon;
|
||||||
tabPage1.Focus();
|
tabPage1.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated(EventArgs e)
|
protected override void OnActivated(EventArgs e)
|
||||||
|
@ -189,7 +189,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
foreach (var c in HotkeyTabControl.SelectedTab.Controls.OfType<InputWidget>())
|
foreach (var c in HotkeyTabControl.SelectedTab.Controls.OfType<InputWidget>())
|
||||||
{
|
{
|
||||||
c.Focus();
|
c.Select();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (w != null)
|
if (w != null)
|
||||||
{
|
{
|
||||||
HotkeyTabControl.SelectTab((TabPage)w.Parent);
|
HotkeyTabControl.SelectTab((TabPage)w.Parent);
|
||||||
w.Focus();
|
w.Select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -610,7 +610,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (!_programmaticallyChangingStopFrameCheckbox)
|
if (!_programmaticallyChangingStopFrameCheckbox)
|
||||||
{
|
{
|
||||||
StopOnFrameTextBox.Focus();
|
StopOnFrameTextBox.Select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
DurationNumeric.Value = Sub.Duration;
|
DurationNumeric.Value = Sub.Duration;
|
||||||
colorDialog1.Color = Color.FromArgb((int)Sub.Color);
|
colorDialog1.Color = Color.FromArgb((int)Sub.Color);
|
||||||
ColorPanel.BackColor = colorDialog1.Color;
|
ColorPanel.BackColor = colorDialog1.Color;
|
||||||
Message.Focus();
|
Message.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ColorPanel_DoubleClick(object sender, EventArgs e)
|
private void ColorPanel_DoubleClick(object sender, EventArgs e)
|
||||||
|
|
|
@ -1500,7 +1500,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_hexFind.InitialValue = _findStr;
|
_hexFind.InitialValue = _findStr;
|
||||||
_hexFind.Focus();
|
_hexFind.Activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
TextRadio.Select();
|
TextRadio.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
FindBox.Focus();
|
|
||||||
FindBox.Select();
|
FindBox.Select();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1074,7 +1074,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (form is LuaRegisteredFunctionsList)
|
if (form is LuaRegisteredFunctionsList)
|
||||||
{
|
{
|
||||||
alreadyOpen = true;
|
alreadyOpen = true;
|
||||||
form.Focus();
|
form.Activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
.ThenBy(l => l.Name)
|
.ThenBy(l => l.Name)
|
||||||
.ToList();
|
.ToList();
|
||||||
UpdateList();
|
UpdateList();
|
||||||
FilterBox.Focus();
|
FilterBox.Select();
|
||||||
|
|
||||||
ToWikiMarkupButton.Visible = VersionInfo.DeveloperBuild;
|
ToWikiMarkupButton.Visible = VersionInfo.DeveloperBuild;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
{
|
{
|
||||||
if (!MainForm.GameIsClosing)
|
if (!MainForm.GameIsClosing)
|
||||||
{
|
{
|
||||||
Focus();
|
Activate();
|
||||||
_suppressAskSave = suppressSave;
|
_suppressAskSave = suppressSave;
|
||||||
NewTasMenuItem_Click(null, null);
|
NewTasMenuItem_Click(null, null);
|
||||||
_suppressAskSave = false;
|
_suppressAskSave = false;
|
||||||
|
|
|
@ -510,7 +510,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (ContainsFocus)
|
if (ContainsFocus)
|
||||||
{
|
{
|
||||||
TasView.Focus();
|
TasView.Select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1464,7 +1464,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Focused)
|
if (Focused)
|
||||||
{
|
{
|
||||||
SpecificValueBox.Focus();
|
SpecificValueBox.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpecificAddressBox.Enabled = false;
|
SpecificAddressBox.Enabled = false;
|
||||||
|
@ -1486,7 +1486,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Focused)
|
if (Focused)
|
||||||
{
|
{
|
||||||
SpecificAddressBox.Focus();
|
SpecificAddressBox.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberOfChangesBox.Enabled = false;
|
NumberOfChangesBox.Enabled = false;
|
||||||
|
@ -1508,7 +1508,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Focused)
|
if (Focused)
|
||||||
{
|
{
|
||||||
NumberOfChangesBox.Focus();
|
NumberOfChangesBox.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
DifferenceBox.Enabled = false;
|
DifferenceBox.Enabled = false;
|
||||||
|
@ -1530,7 +1530,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Focused)
|
if (Focused)
|
||||||
{
|
{
|
||||||
DifferenceBox.Focus();
|
DifferenceBox.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCompareTo(Compare.Difference);
|
SetCompareTo(Compare.Difference);
|
||||||
|
@ -1590,7 +1590,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Focused)
|
if (Focused)
|
||||||
{
|
{
|
||||||
DifferentByBox.Focus();
|
DifferentByBox.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetComparisonOperator(ComparisonOperator.DifferentBy);
|
SetComparisonOperator(ComparisonOperator.DifferentBy);
|
||||||
|
|
Loading…
Reference in New Issue