Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Also covers the escape button working again ;-) #531

Merged
merged 2 commits into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# <img src="https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/Krypton.png"> Standard Toolkit - ChangeLog

## 2022-02-01 - Build 2202 - February 2022
* Fixed [#530](https://github.com/Krypton-Suite/Standard-Toolkit/issues/530), "Ctrl+C" in Error KMessageBoxes no longer works
* Fixed [#525](https://github.com/Krypton-Suite/Standard-Toolkit/issues/525), Undesired behaviour in KryptonGroupBox
* Fixed [#520](https://github.com/Krypton-Suite/Standard-Toolkit/issues/520), KTooltips default to using the KryptonIcon when nothing is set by the developer
* Fixed some minor issues regarding some dark themes
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -526,52 +526,57 @@ private Size UpdateButtonsSizing()
return new Size((maxButtonSize.Width * numButtons) + (GAP * (numButtons + 1)), maxButtonSize.Height + (GAP * 2));
}

private void button_keyDown(object sender, KeyEventArgs e)
private void AnyKeyDown(object sender, KeyEventArgs e)
{
// Escape key kills the dialog if we allow it to be closed
if ((e.KeyCode == Keys.Escape) && ControlBox)
if (ControlBox
&& (e.KeyCode == Keys.Escape)
)
{
Close();
}
else
else if (!e.Control
|| (e.KeyCode != Keys.C)
)
{
// Pressing Ctrl+C should copy message text into the clipboard
if ((e.Modifiers == Keys.Control) && (e.KeyCode == Keys.C))
return;
}

const string DIVIDER = @"---------------------------";
const string BUTTON_TEXT_SPACER = @" ";

// Pressing Ctrl+C should copy message text into the clipboard
var sb = new StringBuilder();

sb.AppendLine(DIVIDER);
sb.AppendLine(Text);
sb.AppendLine(DIVIDER);
sb.AppendLine(_messageText.Text);
sb.AppendLine(DIVIDER);
sb.Append(_button1.Text).Append(BUTTON_TEXT_SPACER);
if (_button2.Enabled)
{
sb.Append(_button2.Text).Append(BUTTON_TEXT_SPACER);
if (_button3.Enabled)
{
StringBuilder sb = new();

sb.AppendLine("---------------------------");
sb.AppendLine(Text);
sb.AppendLine("---------------------------");
sb.AppendLine(_messageText.Text);
sb.AppendLine("---------------------------");
sb.Append(_button1.Text);
sb.Append(" ");
if (_button2.Enabled)
{
sb.Append(_button2.Text);
sb.Append(" ");
if (_button3.Enabled)
{
sb.Append(_button3.Text);
sb.Append(" ");
}
if (_button4.Enabled)
{
sb.Append(_button4.Text);
sb.Append(" ");
}
}
sb.AppendLine("");
sb.AppendLine("---------------------------");
sb.Append(_button3.Text).Append(BUTTON_TEXT_SPACER);
}

Clipboard.SetText(sb.ToString(), TextDataFormat.Text);
Clipboard.SetText(sb.ToString(), TextDataFormat.UnicodeText);
if (_button4.Enabled)
{
sb.Append(_button4.Text).Append(BUTTON_TEXT_SPACER);
}
}

sb.AppendLine(string.Empty);
sb.AppendLine(DIVIDER);

Clipboard.SetText(sb.ToString(), TextDataFormat.Text);
Clipboard.SetText(sb.ToString(), TextDataFormat.UnicodeText);
}

}

#region Types
internal class HelpInfo
{
Expand Down