From 027e37545b398e4f77266a3306ead85bd9ef7165 Mon Sep 17 00:00:00 2001 From: David Sparer Date: Mon, 13 May 2019 12:54:36 -0500 Subject: [PATCH] added a "defaulttext" mode to the ng search box This will prevent a bug when users want to perform a real search using the same term as Language.strSearchPrompt --- mRemoteV1/UI/Controls/Base/NGSearchBox.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mRemoteV1/UI/Controls/Base/NGSearchBox.cs b/mRemoteV1/UI/Controls/Base/NGSearchBox.cs index 2f891023e..585abe26d 100644 --- a/mRemoteV1/UI/Controls/Base/NGSearchBox.cs +++ b/mRemoteV1/UI/Controls/Base/NGSearchBox.cs @@ -6,6 +6,7 @@ namespace mRemoteNG.UI.Controls.Base { public class NGSearchBox : NGTextBox { + private bool _showDefaultText; private PictureBox pbClear = new PictureBox(); private ToolTip btClearToolTip = new ToolTip(); @@ -36,7 +37,7 @@ namespace mRemoteNG.UI.Controls.Base private void FocusLost(object sender, EventArgs e) { - if (string.IsNullOrEmpty(Text)) + if (_showDefaultText) { Text = Language.strSearchPrompt; pbClear.Visible = false; @@ -59,7 +60,8 @@ namespace mRemoteNG.UI.Controls.Base private void NGSearchBox_TextChanged(object sender, EventArgs e) { - pbClear.Visible = Text == Language.strSearchPrompt ? false : TextLength > 0; + _showDefaultText = string.IsNullOrEmpty(Text); + pbClear.Visible = !_showDefaultText && TextLength > 0; } } } \ No newline at end of file