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: 

resize the string array automatically

Solved!
Go to solution

How to resize the string array automatically by extracting the maximum string length in the array? I could extract the string length and set the maximum lenth to the property nodes of array size width and array element size width  and doesn't change. Would any one help on this? 

0 Kudos
Message 1 of 7
(3,566 Views)

String Length is in number of characters

 

The property node Text.Width is in pixels

 

Two differents things

Omar
0 Kudos
Message 2 of 7
(3,561 Views)

You are trying to find the length of the string in characters, and writing that to the Width property node which expects pixels.

You are also using the Minimum of the array rather than the maximum of the array.

 

There is a function called Get Text Rectangle that will give you the size of the text in pixels.  The advantage is that it also accounts for the different widths of different characters in the font.

 

Message 3 of 7
(3,559 Views)
Solution
Accepted by topic author nik35324

Just a minor tweak to RF's code to account for the strangeness that property Text.Width refers to the outside dimention of the surrounding decoration. 

Example_VI.png

Without the add the "g" in "Missing" goes missing.   While this looks like "Just a touch" of overkill select "Visible Items" Display style after running the vi as is Smiley Wink  


"Should be" isn't "Is" -Jay
Message 4 of 7
(3,533 Views)

Very weird.  Your strings do need that.  (Actually makes it a bit wider than it should need to.)

 

When I did it originally, nothing seemed to be cut off.  (Mostly it was various length strings of numbers and "asdf".)  It always seemed to show the whole text.

0 Kudos
Message 5 of 7
(3,527 Views)

Playing a bit more you should probaly subtract Left from Right in case the text is right justified.  trivial


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 7
(3,522 Views)

.  Smiley Happy

0 Kudos
Message 7 of 7
(3,513 Views)