Fixed the Hotkey selection text

Works fine now. No more errant
selections.
This commit is contained in:
Terry MacDonald 2021-04-30 22:11:36 +12:00
parent 43374ff1b2
commit c5121702b2
2 changed files with 13 additions and 6 deletions

View File

@ -42,8 +42,10 @@ namespace DisplayMagician.UIForms
// txt_hotkey
//
this.txt_hotkey.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txt_hotkey.HideSelection = false;
this.txt_hotkey.Location = new System.Drawing.Point(86, 153);
this.txt_hotkey.Name = "txt_hotkey";
this.txt_hotkey.ReadOnly = true;
this.txt_hotkey.Size = new System.Drawing.Size(270, 26);
this.txt_hotkey.TabIndex = 1;
this.txt_hotkey.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
@ -153,6 +155,7 @@ namespace DisplayMagician.UIForms
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose a Hotkey";
this.Activated += new System.EventHandler(this.HotkeyForm_Activated);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -49,7 +49,8 @@ namespace DisplayMagician.UIForms
//hks = new HotkeySelector();
//hks.EmptyHotkeyText = "";
//hks.Enable(txt_hotkey);
this.ActiveControl = txt_hotkey;
//this.ActiveControl = txt_hotkey;
//txt_hotkey.DeselectAll();
}
#pragma warning disable CS3001 // Argument type is not CLS-compliant
@ -62,9 +63,6 @@ namespace DisplayMagician.UIForms
myHotkey = hotkeyToEdit;
Refresh(txt_hotkey);
this.ActiveControl = txt_hotkey;
txt_hotkey.DeselectAll();
if (!String.IsNullOrEmpty(hotkeyHeading))
{
if (hotkeyHeading.Length > 60)
@ -91,7 +89,8 @@ namespace DisplayMagician.UIForms
this.DialogResult = DialogResult.None;
txt_hotkey.Text = "";
myHotkey = Keys.None;
this.ActiveControl = txt_hotkey;
//this.ActiveControl = txt_hotkey;
//txt_hotkey.DeselectAll();
}
private void btn_save_Click(object sender, EventArgs e)
@ -282,6 +281,11 @@ namespace DisplayMagician.UIForms
_invalidKeyCombination.Add(Keys.Control | Keys.Delete);
}
private void HotkeyForm_Activated(object sender, EventArgs e)
{
//this.ActiveControl = txt_hotkey;
txt_hotkey.Focus();
txt_hotkey.DeselectAll();
}
}
}