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: 

How to determine the length of a line of text in a multi line text control

I am working on a simple widget to compare two snippets of text.  The string controls are side by side with a colum of square bools in between

the two string controls.

 

The Bools line up with the lines of text in each string control.  The Bools are used as a quick indicator that at that line point there is a difference

between the two string controls.

 

 There is a slider that allows the user to scroll up and down,  the slider scrolls both string controls simutaneously.

 

As the string controls are scrolled I will be comparing the left and right lines of text and reflecting the match status in the Bool Colum.

 

The reason I need to know the length of the line of text is so each line can be compared against one another.  It is not as simple as counting the

col width of the string control and parsing the text because if there is a line return the text will word wrap before before it extends all the way accross the string control, which will cause parsing discrepencies.

 

Any suggestions on obtaining the multi line string control text character length would be much appreciated.

Best Regards

Tim C. 

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 1 of 3
(2,251 Views)
Front panel of widget....
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 2 of 3
(2,250 Views)

Why not just convert the string into an array of strings separated at the linefeed. Then you can pick off each element as a line of text, and you can get the length by simply using the string length function.

 

You could also use the Scan String for Tokens function by using the linefeed. 

Message Edited by smercurio_fc on 08-29-2008 03:19 PM
0 Kudos
Message 3 of 3
(2,238 Views)