05-12-2004 10:19 AM
05-12-2004 11:33 AM
05-14-2004 04:48 AM
04-22-2005 07:44 AM
04-26-2005 02:12 AM
04-27-2005 08:26 AM
07-16-2015 11:18 AM
Extremely late to the party here...
I required this exact fuction. Put this together today. Specify the max character length and function will insert a CARRAGE RETURN at the end of each set of characters.
Enjoy!
Andrew
LV2010
07-16-2015 11:46 AM - edited 07-16-2015 12:01 PM
This VI is an optimized version of a VI I found on here by Doug Norman. This is a little more advanced as it resizes a control to the same width (in pixels) as the listbox, feeds the text in, lets the resized control wrap the text, then takes each line from the control and adds a return to it. By doing it in this fashion, you wrap based on the width of the MCL and not a predetermined amount of characters.
Edit:
I forgot it contained a typedef. Let me clean it up.
07-16-2015 12:34 PM - edited 07-16-2015 12:36 PM
Here's the cleaned up version. (The Font cluster inside the typedef is the LV typedef for the Font property on any text control - therefore, you select the cell on the MCL and take the font property from there and bundle it into this VI. That way, this VI even takes into account the font properties - like size and style, for instance - when calculating the wrapping.)
Holy cow, I had to use Google Chrome just to upload a zip file...
07-16-2015 01:21 PM
Word wrapping is a very interesting topic and good practice for many programming techniques. My wrapper let's me do cool stuff like this:
Looks better when I run it through my hyphenator first, yet another interesting problem....
Of course for the MCL and its ilk the greedy algorithm (fancy name for the technique described in earlier posts) works just fine.