From b68745f4ae8f8ecf320621f0bdbabf6b632b8772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tin=20=C5=A0vagelj?= Date: Tue, 23 Jul 2024 22:13:09 +0000 Subject: [PATCH] Update GUITransmutation.java Add fallback handling for keypress in Transmutation GUI. --- .../projecte/gameObjs/gui/GUITransmutation.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/moze_intel/projecte/gameObjs/gui/GUITransmutation.java b/src/main/java/moze_intel/projecte/gameObjs/gui/GUITransmutation.java index 1b7d69277..1a9f3311e 100644 --- a/src/main/java/moze_intel/projecte/gameObjs/gui/GUITransmutation.java +++ b/src/main/java/moze_intel/projecte/gameObjs/gui/GUITransmutation.java @@ -121,7 +121,16 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { //This is where key combos and deletion is handled, and where we bypass the inventory key closing the screen return textBoxFilter.keyPressed(keyCode, scanCode, modifiers); } - return super.keyPressed(keyCode, scanCode, modifiers); + boolean passedThrough = super.keyPressed(keyCode, scanCode, modifiers); + if (passedThrough) { + return true; + } + // try passing the unhandled key to textbox + boolean handled = textBoxFilter.keyPressed(keyCode, scanCode, modifiers); + if (handled) { + textBoxFilter.setFocused(true); + } + return handled; } private void updateFilter(String text) { @@ -175,4 +184,4 @@ protected void renderTooltip(@NotNull GuiGraphics graphics, int mouseX, int mous super.renderTooltip(graphics, mouseX, mouseY); } } -} \ No newline at end of file +}