mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user