DisableColor in Grid

Can’t get DisableColor or DisableColorItem to work after onPointerUpObservable is called.

Also, other than lower scaling # s of each button, is there a way put margins easily in a Grid.


Checked on the code, DisabledColor only applies to Button:

Babylon.js/rectangle.ts at master · BabylonJS/Babylon.js (github.com)

And DisabledColorItem only applies to a checked Checkbox:

Babylon.js/checkbox.ts at master · BabylonJS/Babylon.js (github.com)

@sebavan @Deltakosh @RaananW I see these two properties are quite “old” but haven’t been implemented on the Control class itself, maybe it would be better to deprecate them?

About the margins question, I’ll tag our GUI expert @msDestiny14 :smiley:

Thank’s a lot, that makes sense.

I think they have to stay in for back compat but you could definitely add a message in the code doc.


Sorry for the wait but I added the message :smiley: Add info about which classes the disabledColor and disabledColorItem … by carolhmj · Pull Request #11894 · BabylonJS/Babylon.js · GitHub
@charliesideroad do you have any more questions about this?


Oh! Guess this got missed by me from vacation. I can provide some insight into the margins plus quick alternate solutions for a disabled color.

Sounds like you’ll want to try out the padding option. If you want more spacing between elements automatically I’d also recommend trying the stack panel spacing option instead.

Check out this demo I made using the GUI Editor.

In the GUI editor demo I linked, I add a rectangle into the grid cell to act as a base. Then I adjust the padding to create the space you want between the cell. Now, anything inside this rectangle is going to be nicely fit.

An alternative way in code is by adjusting the padding values in the cell container directly. You can get the cell of your grid with grid.cells()l Grid | Babylon.js Documentation

For the disabled color, I would just change the color based on a flag you set in your code. This can be triggered after your onPointerUpObservable .

Hope this answers your question and let me know if you have any other GUI ones. :smiley:

Hello @charliesideroad just checking in, do you have any further questions? :slight_smile: