mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
fixed a few more cases where default text wouldn't behave correctly
This commit is contained in:
@@ -6,10 +6,13 @@ namespace mRemoteNG.UI.Controls.Base
|
||||
{
|
||||
public class NGSearchBox : NGTextBox
|
||||
{
|
||||
private bool _showDefaultText;
|
||||
private bool _showDefaultText = true;
|
||||
private bool _settingDefaultText = true;
|
||||
private PictureBox pbClear = new PictureBox();
|
||||
private ToolTip btClearToolTip = new ToolTip();
|
||||
|
||||
//public override string Text { get; set; }
|
||||
|
||||
public NGSearchBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -39,12 +42,17 @@ namespace mRemoteNG.UI.Controls.Base
|
||||
{
|
||||
if (_showDefaultText)
|
||||
{
|
||||
_settingDefaultText = true;
|
||||
Text = Language.strSearchPrompt;
|
||||
pbClear.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void FocusGot(object sender, EventArgs e) => Text = "";
|
||||
private void FocusGot(object sender, EventArgs e)
|
||||
{
|
||||
if (_showDefaultText)
|
||||
Text = "";
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
@@ -60,8 +68,13 @@ namespace mRemoteNG.UI.Controls.Base
|
||||
|
||||
private void NGSearchBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
_showDefaultText = string.IsNullOrEmpty(Text);
|
||||
if (!_settingDefaultText)
|
||||
{
|
||||
_showDefaultText = string.IsNullOrEmpty(Text);
|
||||
}
|
||||
|
||||
pbClear.Visible = !_showDefaultText && TextLength > 0;
|
||||
_settingDefaultText = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user