LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to enable word wrap within single cells of a table of strings indicator?

Hi All,

I am struggling with an issue that seems really simple but I cannot find a solution in LabVIEW 2017:

 

I am reading from a spreadsheet in which each cell contains strings of text.  I want to display the output as a table.  That part is easy.  The challenge is that some of the cells contain short strings (as short as "No") and other entries have strings that are as long as a paragraph.  

 

I see that tables have AutoRowHt property nodes, but that only seems to work if the string already includes hard returns that split the original strings into multiple lines.  But my paragraphs do not contain any hard returns.  

 

What I'd like to achieve is this:  I'd like to be able to configure the table and set an arbitrary column width (that I can do already).  Then I'd like the VI to read the array of strings and place them in the individual cells.  If a string in any given cell is slightly longer than can be displayed in one line, I'd like LabVIEW to programmatically adjust column width to accommodate a few more characters in that line.  If a string is significantly longer (e.g., two or more sentences) than can be displayed in one line, I'd like LabVIEW to automatically wrap the text inside the cell (while conforming to the preset column width), then automatically alter cell row height (which I believe would be achieved with AutoRowHt). Is it possible to enable automatic resize column width (for small adjustments) or enable automatic word wrap to create multiline strings without first adding hard returns to the strings?

 

If it helps, I am including the VI I'm writing and the actual CSV file I'm working with.

 

To see the most serious entry I'm dealing with, run the VI, and select "Obstetric and Gynecologic." That is the longest paragraph I need to display in one cell.  However it is not the only one.

 

I hope this can be done. It would greatly simplify my user display.  Thank you in advance.

Cheers, Eric

 

P.S., in case anyone is wondering what this content is, I am working with an old freeware program called ENDOCAL which contained virtual patients that premed students and med students could interact with to develop clinical diagnostic skills.  The original program was developed in DOS and we are trying to upgrade the program in our classrooms using a LabVIEW environment.  The original software still works if you install a DOS emulator, but it is strictly keyboard based, it is limited to a 640x480 window display, and it cannot be updated with current medical information.

0 Kudos
Message 1 of 3
(4,381 Views)

Hi Eric

 

I Don't think it's native to any kind of listbox, table or array of strings to auto-wrap to a column width. 

 

However, there are some good sample VI's to do what you're after. Now you'll have to do it on a cell by cell basis but one of the attached VI's should be what you're looking for. Note: these are quick and dirty solutions taken from other solved discussion forum post..

 

Also, pretty interesting application!

 

Cheers

Jono

Download All
0 Kudos
Message 2 of 3
(4,336 Views)

Hi JCH_26,

 

Thanks for the suggestions.  They actually both work well enough.  I tried them both, plus a few modifications of each, independently and within my code.  They adapted well with my data sheets when handled on a cell by cell basis; i.e., they will work satisfactorily in a 1D array or 1D table if the long text is in the first cell.  But if the long string is in the second cell, then the cell doesn't satisfactorily respond (I needed to click my mouse inside the cell before it would autosize). Also, if the array or table is 2D (as are mine), then all of the rows get the same height (no surprise there in arrays, but I didn't know how tables would respond), which is also not desired.  Alas, I don't think there is a satisfactory solution to my particular idea.  So I've chosen to go a different way.  I split the 2D array into separate 1D arrays.  The first column is then treated as a second listbox on the screen, and the second column is consequently treated as a single string indicator.  It does require more user interaction (they need to select items in the second listbox to see the data, vs. having the data display for all list items spontaneously).  Not ideal, but acceptable.  And as such, I don't need to deal with automatic word wrap because that can be done spontaneously in a string indicator. For fun, here is the code I settled on.  Thanks for your suggestions.  Eric

0 Kudos
Message 3 of 3
(4,298 Views)