hide codemenu onlostfocus

codemenu was remaining open when the application lost focus because it
was tied to the leave event rather than the focus events.
This commit is contained in:
David Ruhmann 2015-08-19 17:28:45 -05:00
parent 49bb9f7e80
commit 6d91464604

View file

@ -72,7 +72,12 @@ public static ContextMenuStrip Create<TEntry>(TextBox tb, params TEntry[] ignore
if (cms.Items.Count > 0) cms.Show(tb, new Point(tb.Width + 1, 0));
};
tb.Leave += (sender, e) =>
tb.GotFocus += (sender, e) =>
{
if (cms.Items.Count > 0) cms.Show(tb, new Point(tb.Width + 1, 0));
};
tb.LostFocus += (sender, e) =>
{
if (cms.Visible) cms.Close();
};