I am using buttons in my game that have an image on them (dice). I want them disabled until they are playable however I do not want them to be grey’d out. Is there a way to do this without adding a ton of blocks?
You will evidently need a few more blocks, but not a ton.
The idea is that, instead of disabling the button, you set a global variable, let’s call it “enable_button” and set it by default to true. When the button needs disabling, you set that variable to false instead of actually disabling the button.
Then in the button.click event block, you enclose ALL of the processing in a conditional block “if enable_button do”.
If the user clicks the button when enabled, which is the default, it works normally. But when “enable_button” is false, then the logic skips everything that the button would be doing, so is effectively defeated. You still can click it, but there will be zero effect.
Until “enable_button” is returned to true.
I kinda figured I’d have to do that LOL. I just figured I’d put it out there in case I missed a setting or something. Thanks.
Hi,
On the scrButtons screen, you will find the Disabled button, which is not pressed or turned gray.
https://x.thunkable.com/projects/5cd84f23e3097f3353fdad45/project/properties/designer/
What a great idea!
It helped me!
Thanks!
I am not finding the blocks used to do that?
Everything is very simple - you need to cover the button with a transparent cover:
- Add a Column1 size to the project and insert a button into it.
- Add another Column2 to Column1 (in front of the button) and make its background red
- On the Advanved tab for Column2, set the position = absolute property, and in the Start block add Column2.width = 100% and Column.height = 100% blocks
Run the project. If the red Column2 covered the button, then set instead of the red color for Column2 a transparent background.