G4P textField focus and move caret


#1

Howdy all,

I’ve just started using G4P in a small personal project of mine, and I’m trying to set up a basic ‘console’ type UI/system for it.

The issue:
I’m trying to setup a system where the user can start typing, and (if consoleTB is unselected) automatically select the textbox, move the caret to the end of the line, and start entering what they’re typing in.

The textField is called ‘consoleTB’.
I’m using a boolean called ‘consoleTB_focus’ that holds whether or not the textField is selected.
I’m using ‘void keyPressed()’ to detect if any keys are pressed.

I suppose my actual question here is “is there a way to focus the textField, and move then caret to the end”.

Any advice?

Kind Regards.


#2

I am away from my computer for several days but I suggest that you look at the API of GAbstractControl or GEditableTextControl for a setFocus and move Carat methods I thing they are in there somewhere :thinking: