Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling a TextButton

Tags:

libgdx

I am trying to disable a TextButton that I've coded as follows:

    // Setup new game button
    final TextButton newGameButton = new TextButton("New Game", style);
    newGameButton.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
                int pointer, int button) {
            Tyr.getInstance().setScreen(new GameScreen());
            AudioHelper.stopMusic();
            return true;
        }
    });
    table.add(newGameButton).spaceBottom(BUTTON_SPACE);
    table.row();

However, the "setDisabled(true)" function doesn't seem to be working. Is there some other way that I can accomplish this task?

like image 966
user2303325 Avatar asked May 18 '14 21:05

user2303325


People also ask

How do you turn off TextButton on Roblox?

You can disable text rendering by setting TextButton. TextTransparency to 1. This will leave you with a plain rectangle that can be used as a button.

How do I enable or disable TextButton Flutter?

Step 1: Add the ElevatedButton to your page. Step 2: Inside the ElevatedButton, assign the null value to the onPressed parameter. Step 3: Run the app. Similarly, you can disable the other buttons such as TextButton, OutlinedButton, FloatingActionButton, IconButton, etc.

How do you disable cards in Flutter?

You need to pass null to onPressed parameter of Buttons in Flutter to disable.


1 Answers

Found a solution: "newGameButton.setTouchable(Touchable.disabled);"

like image 63
user2303325 Avatar answered Oct 30 '22 11:10

user2303325