Add a disabled state to the button#2008
Conversation
|
What is the motivation for this? |
Prevent the receipt of click events in a context where a temporary block or restriction is in effect for that event. Simply put, for example, the user cannot press "Join" to connect to a server as long as the IP address input field is empty, as this is a knowingly unsuccessful event. The code for handling click events can become simpler now, as there is a kind of guarantee that if a button is pressed, the context is inherently correct. Secondly, it provides quick visual feedback to the user about the unavailability of an action. Otherwise, for instance, in an invalid context, it would be necessary to provide feedback to the user after the click, such as displaying an error message or a message about invalid input (as in the example above), and this requires additional logic for message delivery and so on. |
|
Could you then please implement this for the |
You can test this right now on the server-list (#2017) branch. But if there are any objections, I can implement it for the |
|
It'll be easier to review if you can implement it on a button that exists in the master branch, like the ``Join` button suggestion |
| else | ||
| normalTextures; | ||
| draw.setColor(0xff000000); | ||
| draw.setColor(if(self.disabled) 0xa0000000 else 0xff000000); |
There was a problem hiding this comment.
This should be a separate texture, to give more artistic control.
With a reference use-case (showing the social settings that cannot be changed when in the world, previously they were hidden, now they are shown as disabled): <img width="1280" height="745" alt="Screenshot at 2026-06-10 08-51-22" src="https://github.com/user-attachments/assets/6e606d14-bcf7-470b-a603-20a8804a806e" /> To achieve this I made a small change to the button interface to allow for optional arguments replaces #2008 fixes #2556 --------- Co-authored-by: Carrie <carriecapp9@gmail.com>
|
superseded by #3203 |

Adds a
disabledfield to the button struct.Now any button can be easily disabled by setting
button.disabled = true.