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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -