OptionButton resize behaviour inside a container

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Trider

How can I make an OptionButton always occupy the size of its largest item?

Otherwise I have the following situation, where the GridContainer always resizes on item changes.

:bust_in_silhouette: Reply From: timothybrentwood

Figure out the width required to house your largest text option and set that to be rect_min_size.x of that control node.

If you want to do it programmatically, I think you should be able to use Font.get_string_size() to determine the width of your longest text option.

I hoped a cleaner solution existed

Trider | 2021-05-05 12:59

You can adjust your rect_min_size values in your editor while your game is running and the changes will take effect in real time. It’s pretty quick to create really nice GUIs via the editor utilizing that feature.

timothybrentwood | 2021-05-05 13:07