Disabling TextButton

I am trying to disable TextButton, which I encoded 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 does not work. Is there any other way I can accomplish this task?

+4
source share
1 answer

Solution found: "newGameButton.setTouchable (Touchable.disabled);"

+17
source

Source: https://habr.com/ru/post/1541048/


All Articles