LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change dimensions of an string indicator depending on string length

please see the attached VI!
Message 1 of 10
(4,856 Views)
you can use the width property node for the string indicator to set the width of the indicator... with a little experimenting you can calculate the width you need depending on the font you are using...

Good Luck

Dan
0 Kudos
Message 2 of 10
(4,853 Views)
Hi Dan,

yes, of cause. I did already.
But the problem is, I want to the application with different languages. The strings (all labesl) are saved in a file wich the user can edit. For example in english "Ready" means in German "Betriebsbereit".

If you see the attached VI, the indicator is used as a title of a section (windows style). The indicator is laid over the frame, if it´s to long and a short string is shown, the frame don´t look good! See the attachment!
0 Kudos
Message 3 of 10
(4,851 Views)
something like this wont work for you ??? it makes the indicator just big enough to fit your text... or am i missing something ??

Dan
Message 4 of 10
(4,839 Views)
also if you can use one of the true type fonts it would make your width calculations easier since each character is the same width i believe...

Dan
0 Kudos
Message 5 of 10
(4,834 Views)
Yes, this works.

I did it like your way before, but the next time the language might be french or spanish etc., and the strings differ in their lenght.
I´ll try true type fonts and use the "sting lenght" function. Maybe it will work for any lenght.........!



Thanks for you help!
0 Kudos
Message 6 of 10
(4,829 Views)
Try this example. I even gave you the ability to fudge my answer how you want 🙂 This solution involved the use of a picture.llb function called get text rect.vi. This will give you the size that you need for the string you pass in and then you can adjust the size appropriatly using the control width properties. The fudge factor is included to account for the border of the string control. We found that about 14 pixels is appropriate. Hope this helps. I give credit to Ben and Kazuo for helping me with this one!!! Go Team!!!
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
Message 7 of 10
(4,824 Views)
forgot to attach.. 🙂 sorry
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
Message 8 of 10
(4,823 Views)
Thats the solution!!!!
0 Kudos
Message 9 of 10
(4,811 Views)
Here is it as a SubVI.

Maybe someone can use it, too.
Message 10 of 10
(4,770 Views)