Jump to content

Recommended Posts

Posted

Hello! I'm making a search bar for my mod and I was wondering where I can find how to implement a ctrl + a to select all and being able to hold delete. I'm currently using an integer to store my keyCodes and I was wondering if there was a way to check if a combination of keyCodes are typed and if you can hold them down.

Posted

I don't know why you're reimplementing a system that has already been implemented.

Having messed with Minecraft's text fields before (and having to dicker around with multi-line selections) I can tell you aren't using the UI widgets that already exist.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I'm using the GuiScreen keyTyped function in an extended class, because the search bar is in a Gui. This is the code that I currently have

 

	public void keyTyped(char typedChar, int keyCode) {
        if (focus) {
            if (keyCode == 28) {
            	focus = false;
            } else if (keyCode == 14) {
                if (!typed.isEmpty()) {
                	typed = typed.substring(0, typed.length() - 1);
                }
            } else if (ChatAllowedCharacters.isAllowedCharacter(typedChar)) {
            	typed += typedChar;
            }
        }
	}

 

Posted

No seriously, have you even looked at GuiTextField?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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