testing - libgdx, textfield test focus -
i know how check if textfield focus. have add focuslistener : field.addlistener( new focuslistener() {});
. what's next in if() ?
i wrote detect when libgdx textfield has been focused using either mouse or tab key.
<textfield>.addlistener(new focuslistener(){ @override public boolean handle(event event){ if (event.tostring().equals("mousemoved") || event.tostring().equals("exit") || event.tostring().equals("enter") || event.tostring().equals("keydown") || event.tostring().equals("touchup")){ return false; } //add focus handling code here. system.out.println("focused"); return true; } });
simply call method , whenever textfield focused, using either tab key or click, print "focused" console.
feel free ask more if needed!
i hope helps!
Comments
Post a Comment