10-30-2017 04:42 AM
Hi All,
I am using a number of labview button controls which are assigned a specific task dynamically. The text on the buttons is load from a text file. Is there a way to automatically cut off the text in case it is too long so it will not exceed the width of the button?
Solved! Go to Solution.
10-30-2017 04:50 AM
10-30-2017 04:57 AM
Hi Gerdw,
Thanks for your reply. It is a pity that the control itself hasn't this functionality built in. With the manual set string length non monospace fonts will result in different text widths and changing the button text size results in manually changing the string length by testing how many characters can fit on the button.
10-30-2017 05:07 AM
Hi svh,
you're suggested the somewhat more complicated solution:
- draw the string into a 2D picture indicator. This way you can test the string length in pixels!
- use this information to limit the string to a maximal size in pixels…
It is a pity that the control itself hasn't this functionality built in.
Why should that be built-in? It's your responsibility as a programmer when you want to fiddle with UI elements at runtime!
(Other suggestion: put a (somewhat larger) string indicator next to your button. Now your button can be labelled "OK" all the time…)