Skip to content

Commit

Permalink
Allow selecting control by clicking edit and hotkey buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaex committed Jul 31, 2022
1 parent e134ae1 commit 93cb759
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ShareX/Controls/HotkeySelectionControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions ShareX/Controls/HotkeySelectionControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ private void StopEditing()
UpdateHotkeyStatus();
}

private void SelectControl()
{
Selected = true;
OnSelectedChanged();
}

protected void OnHotkeyChanged()
{
HotkeyChanged?.Invoke(this, EventArgs.Empty);
Expand All @@ -234,17 +240,14 @@ protected void OnEditRequested()
EditRequested?.Invoke(this, EventArgs.Empty);
}

private void btnTask_MouseClick(object sender, MouseEventArgs e)
private void btnTask_Click(object sender, EventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Selected = true;
OnSelectedChanged();
}
SelectControl();
}

private void btnEdit_Click(object sender, EventArgs e)
{
SelectControl();
OnEditRequested();
}

Expand Down Expand Up @@ -309,6 +312,7 @@ private void btnHotkey_MouseClick(object sender, MouseEventArgs e)
}
else
{
SelectControl();
StartEditing();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ShareX/Controls/HotkeySelectionControl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<value>219, 27</value>
</data>
<data name="btnHotkey.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
<value>2</value>
</data>
<data name="btnHotkey.Text" xml:space="preserve">
<value>Hotkey</value>
Expand Down

0 comments on commit 93cb759

Please sign in to comment.