From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically autosize a string indicator

Here is a real challenge I would say: Programmatically size a string indicator and/or the window size, such that it mimics the behaviour of the 'message' indicator of the One Button Dialog box.
0 Kudos
Message 1 of 5
(2,739 Views)
This isn't difficult. You just have to find the right VIs to do it Smiley Wink
Use the "Get Text Rect.vi" in picture.llb (in LV7.1). Depending on the font and other parameters it'll return the size of the text in pixels. Use this output to set the string indicator size (maybe adding a constant) and the windows size (adding a constant).

0 Kudos
Message 2 of 5
(2,737 Views)
Can't edit my thread Smiley Surprised
It seems adding 20 to horizontal and 12 to vertical size leads to good results when using a standard string control/indicator.
Just set the size property of the string control/indicator.
0 Kudos
Message 3 of 5
(2,732 Views)
Thanks a lot Dan, I tried the Bounds property instead of the Size property. Bounds is read-only, Size can be set during run-time. The Get Text Rect.vi and related are very useful indeed.
0 Kudos
Message 4 of 5
(2,722 Views)
Glad I could help. Yes there are indeed some very useful functions hidden in the depth of the included libraries but not accessible directly from the functions palette.
Message 5 of 5
(2,718 Views)