ToneGodGUI - Enabled Elements

If you remove an window from the screen with screen.removeElement(window);
The window has a TextField inside of it. The TextField input is still active, taking inputs and everything.

I would think it would be best in the function removeElement to call setIsEnabled(false) to prevent text input. You can look at the class and everything about it is active and taking input.

The window class “cleanup” method ends up calling “controlCleanupHook()” on every element but TextField doesn’t override this function so nothing happens.

If it was designed this way, what is the best way to remove a window and it not be active.

Other option that should be is the setIsEnabled that TextField Overrides. it doesn’t call “SUPER” to make sure lower classes of setIsEnabled are set correctly.

Thanks,

Kevin

1 Like

Also,
There is another issue. If you have Multiple Screens, say one in each AppState.

When the appstate is detach and removed. You go through the process to detach the windows from the screen and then remove the control (screen) from the guiNode. But the issue is the
addRawInputListener() that is called in the init class, never calls removeRawInputListener().

So what happen.

MainMenuAppState has buttons and launches the game.

The game creates a new screen and adds a couple of windows and inside one window it has a TextField. When game is over and it does cleanup. It removes everything correctly. But since RawInputListener is never called it does remove the game.

Game goes back to mainMenu, play clicks on play again.

The game creates a new screen and adds a couple of windows and inside one window it has a TextField. But the problem is the fist gameAppState has the attachment to RawInputListener still and consume the input and the second never gets it.

So solution is needing a function in screen to call that it will call removeRawInputListener.

Can I submit these changes?

Kevin

1 Like

Can I submit these changes?

Sure. But please test them first.

1 Like