Skip to content

Commit 00d97ad

Browse files
authored
Fixes input windows having to be refocused before they can be edited (OpenDreamProject#2497)
1 parent 93591d5 commit 00d97ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

OpenDreamClient/Interface/Prompts/InputWindow.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace OpenDreamClient.Interface.Prompts;
55

66
[Virtual]
77
internal class InputWindow : PromptWindow {
8+
private Control? _focusControl;
9+
810
protected InputWindow(string title, string message, bool canCancel,
911
Action<DreamValueType, object?>? onClose) : base(title, message, onClose) {
1012
CreateButton("Ok", true);
@@ -14,7 +16,13 @@ protected InputWindow(string title, string message, bool canCancel,
1416
protected void SetPromptControl(Control promptControl, bool grabKeyboard = true) {
1517
InputControl.RemoveAllChildren();
1618
InputControl.AddChild(promptControl);
17-
if (grabKeyboard) promptControl.GrabKeyboardFocus();
19+
if (grabKeyboard) _focusControl = promptControl;
20+
}
21+
22+
protected override void Shown() {
23+
base.Shown();
24+
25+
_focusControl?.GrabKeyboardFocus();
1826
}
1927

2028
protected override void ButtonClicked(string button) {

0 commit comments

Comments
 (0)