Posted March 3, 20232 yr Hi! I have screen that has some edit boxes on it. When player opens the screen I would like the first edit box be active so I could start typing in that without having to click on it before. @Override public void init() { super.init(); this.minecraft.keyboardHandler.setSendRepeatsToGui(true); TBDisplay = new EditBox(this.font, this.leftPos + 7, this.topPos + 11, 150, 20, Component.literal("")); this.addWidget(this.TBDisplay); //Initialize other components //Trying to set the focus TBDisplay.setCanLoseFocus(false); TBDisplay.active = true; TBDisplay.setFocus(true); } Setting the focus after initializing this and all other components on the screen highlights the edit box, but I still have to click on it before I can write something in it. How to make the edit box focused and writable without clicking on it? Thanks. Edited March 4, 20232 yr by RInventor7
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.