Don't set the focus of the text widget until the first draw.

This commit is contained in:
Lars Brubaker 2015-08-07 11:38:58 -07:00
parent bc1f45f8b8
commit 9c415ab270
4 changed files with 24 additions and 5 deletions

View file

@ -102,7 +102,17 @@ namespace MatterHackers.MatterControl
topToBottom.AddChild(buttonRow);
ShowAsSystemWindow();
UiThread.RunOnIdle(folderNameWidget.Focus);
}
bool firstDraw = true;
public override void OnDraw(Graphics2D graphics2D)
{
if (firstDraw)
{
UiThread.RunOnIdle(folderNameWidget.Focus);
firstDraw = false;
}
base.OnDraw(graphics2D);
}
private void ActualTextEditWidget_EnterPressed(object sender, KeyEventArgs keyEvent)

View file

@ -137,8 +137,17 @@ namespace MatterHackers.MatterControl
topToBottom.AddChild(buttonRow);
ShowAsSystemWindow();
}
UiThread.RunOnIdle(textToAddWidget.Focus);
bool firstDraw = true;
public override void OnDraw(Graphics2D graphics2D)
{
if (firstDraw)
{
UiThread.RunOnIdle(textToAddWidget.Focus);
firstDraw = false;
}
base.OnDraw(graphics2D);
}
private void ActualTextEditWidget_EnterPressed(object sender, KeyEventArgs keyEvent)

View file

@ -53,6 +53,7 @@ namespace MatterHackers.MatterControl
public TerminalWidget(bool showInWindow)
{
this.Name = "TerminalWidget";
this.BackgroundColor = backgroundColor;
this.Padding = new BorderDouble(5, 0);
FlowLayoutWidget topLeftToRightLayout = new FlowLayoutWidget();
@ -141,8 +142,6 @@ namespace MatterHackers.MatterControl
manualCommandTextEdit.ActualTextEditWidget.EnterPressed += new KeyEventHandler(manualCommandTextEdit_EnterPressed);
manualCommandTextEdit.ActualTextEditWidget.KeyDown += new KeyEventHandler(manualCommandTextEdit_KeyDown);
manualEntryLayout.AddChild(manualCommandTextEdit);
UiThread.RunOnIdle(manualCommandTextEdit.Focus);
}
manualEntryTopToBottomLayout.AddChild(manualEntryLayout);
@ -212,6 +211,7 @@ namespace MatterHackers.MatterControl
{
filterOutput.Checked = UserSettings.Instance.Fields.GetBool(TerminalFilterOutputKey, false);
firstDraw = false;
UiThread.RunOnIdle(manualCommandTextEdit.Focus);
}
base.OnDraw(graphics2D);
}

@ -1 +1 @@
Subproject commit 31f7c3892342e1d28f1ca357ceb65e8fb0cdc49d
Subproject commit f52d6ed36c2ef23daa62451bbf9e2b54fb76316e