Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by RInventor7

  • RInventor7 changed the title to Make EditBox active and focused when screen opened [1.19.2] [SOLVED]

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.