Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit 547a977

Browse files
add clear button to search bar, fixes #90
1 parent 7213422 commit 547a977

File tree

2 files changed

+50
-12
lines changed

2 files changed

+50
-12
lines changed

‎UnityLauncher/Form1.Designer.cs‎

Lines changed: 29 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnityLauncher/Form1.cs‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ void FilterRecentProject(object sender, EventArgs e)
284284
{
285285
SetStatus("Filtering recent projects list ...");
286286
string searchString = tbSearchBar.Text;
287+
287288
foreach (DataGridViewRow row in gridRecent.Rows)
288289
{
289290
if (row.Cells["_project"].Value.ToString().IndexOf(searchString, StringComparison.OrdinalIgnoreCase) > -1)
@@ -295,6 +296,9 @@ void FilterRecentProject(object sender, EventArgs e)
295296
row.Visible = false;
296297
}
297298
}
299+
300+
lblClearSearchField.Visible = tbSearchBar.Text.Length > 0;
301+
298302
}
299303

300304
void FilterUnityUpdates(object sender, EventArgs e)
@@ -846,6 +850,7 @@ private void Form1_KeyPress(object sender, KeyPressEventArgs e)
846850
if (tabControl1.SelectedIndex == 0 && tbSearchBar.Text != "")
847851
{
848852
tbSearchBar.Text = "";
853+
lblClearSearchField.Visible = false;
849854
}
850855
else if (tabControl1.SelectedIndex == 3 && tbSearchUpdates.Text != "")
851856
{
@@ -864,6 +869,7 @@ private void Form1_KeyPress(object sender, KeyPressEventArgs e)
864869
tbSearchBar.Focus();
865870
tbSearchBar.Text += e.KeyChar;
866871
tbSearchBar.Select(tbSearchBar.Text.Length, 0);
872+
lblClearSearchField.Visible = tbSearchBar.Text.Length > 0;
867873
}
868874
break;
869875
}
@@ -1454,5 +1460,20 @@ private void btnPlayerLogFolder_Click(object sender, EventArgs e)
14541460
}
14551461
}
14561462
}
1463+
1464+
private void lblClearSearchField_Click(object sender, EventArgs e)
1465+
{
1466+
tbSearchBar.Text = "";
1467+
}
1468+
1469+
private void lblClearSearchField_MouseEnter(object sender, EventArgs e)
1470+
{
1471+
((Label)sender).ForeColor = Color.FromArgb(255, 0, 0, 0);
1472+
}
1473+
1474+
private void lblClearSearchField_MouseLeave(object sender, EventArgs e)
1475+
{
1476+
((Label)sender).ForeColor = Color.FromArgb(128, 128, 128, 128);
1477+
}
14571478
} // class Form
14581479
} // namespace

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /