LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic string size

Hi, I have a string control with a fixed size and I need to change the font size to maximize the use of the control area. The idea is to know the perfect font size for any given string control size. ¿How can I do that in LabVIEW 7.1? The string may have any number of characters, but not more than 50, and it may be splitted in 2 or more rows.

I tried calculating the string control area and comparing with font areas using a loop, increasing size in each iteration, but it doesn't seem a good solution, it is too slow and the result is never perfect. ¿Any better ideas?


I need also to know if it is possible to change control labels inside an array without changing all of them.

Thank you 🙂
Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Message 1 of 6
(2,948 Views)
Hi Nestor,

for the control inside array: all elements of an array have the same properties - their only difference is the value! So you cannot change the caption of single controls in an array.

For your font size: One way to make your loop version faster is to use a pre-calculated (maybe on first use) array with size values for different fontsizes and string length...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,939 Views)
Thanks for your answer. I realized while writing that the loop isn't really necessary, I can calculate the area size in one step and make some adjustments later. It seems to work better now 🙂

I know that about arrays, but  I was wondering if there is some way to do that... 😞
Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Message 3 of 6
(2,933 Views)
Try changing your string to a monospace font, e.g. Courier New. the size of the string will be completely dependent on the number of characters.
0 Kudos
Message 4 of 6
(2,928 Views)
Hi Nestor,

one way to change the caption is to use clusters instead of arrays... No need to wonder Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(2,926 Views)
You are right Joseph, it's crazy if you don't use monospace fonts.

Clusters don't work fine in this application, I tried in my first attempt.

Anyway everything works fine now, I don't really need labels. Thank you!
Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Message 6 of 6
(2,917 Views)