10-24-2025 03:39 AM
Hi everyone,
I wonder if there's a dynamic way to resize front panel objects—such as string indicators—based on their content. For example, I'd like an indicator to automatically adjust its width or height depending on the length of the text it displays, without having to set fixed dimensions manually.
Has anyone implemented something similar or found a workaround for this? I'm working on a UI that needs to adapt to varying data sizes, and I'm trying to keep the interface clean and readable without wasting space.
Any suggestions or examples would be greatly appreciated!
Thanks in advance,
Fabio
10-24-2025 04:23 AM
Sure, use Get Text Rect.vi
10-24-2025 04:25 AM
Hi Fabio,
@fabio.int wrote:
For example, I'd like an indicator to automatically adjust its width or height depending on the length of the text it displays, without having to set fixed dimensions manually.
You can determine the (pixel) size of your text by using the 2DPicture functions.
Using this information you can then adjust the size of the string indicator using its property nodes...
10-24-2025 04:49 AM
Thanks for your reply!
I realize I didn't explain myself clearly earlier. What I'm actually trying to do is adjust the font size of a string indicator dynamically, so that the text fits within the fixed width of my front panel. In other words, instead of resizing the indicator itself, I'd like the font size to adapt based on the length of the content.
Has anyone tried something similar or found a way to achieve this?
10-24-2025 06:53 AM - edited 10-24-2025 06:55 AM
Hi Fabio,
@fabio.int wrote:
What I'm actually trying to do is adjust the font size of a string indicator dynamically, so that the text fits within the fixed width of my front panel.
You basically do the same steps:
@fabio.int wrote:
I wonder if there's a dynamic way to resize front panel objects—such as string indicators—based on their content.
I realize I didn't explain myself clearly earlier.
Yes.
In your first message you wanted to change the object size depending on the content.
Now you want to change the content size for a fixed object size…
10-24-2025 11:41 AM
Consider leaving the font size alone for accessibility reasons and allow the user to scroll through the string indicator.
Readable, but incomplete:
Not readable for most audiences, still incomplete
Readable, incomplete:
Generally, I think your UI will be better if you decide how much space you can allocate for each control and indicator, keep a consistent font size, and let the user scroll through text where there is more information than fits in the allotted indicator size.