Creating a dynamic button

I want to create a dynamic rectangular button such that whatever text it takes from HCMS. It scales accordingly. Is it possible in Intuiface ?

Hi and welcome to the Intuiface community.

Usually, our users like to control the exact pixel dimensions of visual elements added to a scene, so the feature that Intuiface offers is to let you specify the exact size of the button you want / need, then adjust the text font size automatically so it fits that button, not the other way around. See the screenshot below.

If you still want to adjust the size of the button based on the text length, you can bind the Width of your button to your text itself, then use a Custom Script converter to compute your dynamic width. The formula will vary depending on the font you use, lower or upper case characters and potentially many other factors.

Hello Seb,
Thank you for answering my question. I want to ask one more thing that how does X position and width work. Like I want the item to be placed at the same place for example 64 px from left of the screen. I have a calculation for width which works fine but because the X position is fixed the item adjusts according to the width and is moved from the initial position. What I can do with X position to keep it 64 px left of the screen.
Thank you!

Hello Seb,
Thank you very much for the help. I figured out the X positioning calculation myself and completed the dynamic button.

1 Like