From e4bd293915ea20359dc228a623c08f7a1055d843 Mon Sep 17 00:00:00 2001 From: moller21 <42100910+moller21@users.noreply.github.com> Date: Mon, 1 Jun 2020 17:02:56 +0200 Subject: Added gui's for the rest of em covers. --- src/main/java/gregtech/api/gui/GT_GUICover.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/api/gui/GT_GUICover.java') diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java index 94346186a8..f1232c9432 100644 --- a/src/main/java/gregtech/api/gui/GT_GUICover.java +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -157,8 +157,10 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender public void mouseClicked(int x, int y, int button) { for (GT_GuiIntegerTextBox tBox : textBoxes) { boolean hadFocus = tBox.isFocused(); - tBox.mouseClicked(x,y,button); - if (tBox.isFocused() && button == 1) //rightclick -> lcear it + if (tBox.isEnabled() || hadFocus) + tBox.mouseClicked(x,y,button); + + if (tBox.isFocused() && button == 1 && tBox.isEnabled()) //rightclick -> lcear it tBox.setText("0"); else if (hadFocus && !tBox.isFocused()) applyTextBox(tBox); @@ -193,6 +195,9 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender return; } } + if (textBoxes.size() > 0 ) + setFocusedTextBox(textBoxes.get(0)); + return; } if (focusedTextBox != null && focusedTextBox.textboxKeyTyped(c, key)){ @@ -239,7 +244,7 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender */ private void setFocusedTextBox(GT_GuiIntegerTextBox boxToFocus) { for (GT_GuiIntegerTextBox textBox : textBoxes) { - textBox.setFocused(textBox.equals(boxToFocus)); + textBox.setFocused(textBox.equals(boxToFocus) && textBox.isEnabled()); } } public void applyTextBox(GT_GuiIntegerTextBox box) { -- cgit