TextField setMaxLength can't add character while selected

Anything libgdx related goes here!

TextField setMaxLength can't add character while selected

Postby bitmojo » Wed Jan 29, 2020 7:30 pm

I'm experiencing an issue that was supposed to be closed several years ago with the latest release of LibGDX:

https://github.com/libgdx/libgdx/issues/1272

Any idea on how to correct it?
bitmojo
 
Posts: 10
Joined: Fri Oct 14, 2016 1:57 am

Re: TextField setMaxLength can't add character while selecte

Postby shatterblast » Wed Jan 29, 2020 10:37 pm

bitmojo wrote:I'm experiencing an issue that was supposed to be closed several years ago with the latest release of LibGDX:

https://github.com/libgdx/libgdx/issues/1272

Any idea on how to correct it?

Use this. You will have to either manually adjust the width of the Button yourself or feed a variable into it, though.
Code: Select all
      Label softPause_Label = new Label( "Pause", skin );
      softPause_Label.setAlignment( Align.center );
      softPause_Label.setTouchable( Touchable.disabled );
      Button softPause_Button = new Button( skin );
      softPause_Button.setDisabled( false );
      softPause_Button.setTouchable( Touchable.enabled );
      Stack softPause_Stack = new Stack(
            softPause_Button,
            softPause_Label );
      Container softPause_Container = new Container( softPause_Stack );
      softPause_Button.setWidth( 90f );
      softPause_Container.width( softPause_Button.getWidth() );
      softPause_Container.setPosition(
            50,
            20 );
      softPause_Container.layout();

      softPause_Button.addListener(new ClickListener() {
         @Override
         public void clicked(
               InputEvent event,
               float x,
               float y ) {
                //todo  Insert code to run here.
         }
      });
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm


Return to Libgdx

Who is online

Users browsing this forum: Google [Bot] and 1 guest