LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you autosize column widths in a multicolumn listbox?

Hello everyone involved,

I am using LV8.0.1 and SteveP's VI is in LV8.5.  Does anyone have an 8.0.1 version of the VI that they'd be willing to share?

Thanks,

Chris

0 Kudos
Message 11 of 17
(4,841 Views)
0 Kudos
Message 12 of 17
(4,837 Views)
Mike S81,
 
Wow, thanks for the quick response!
 
Chris
0 Kudos
Message 13 of 17
(4,834 Views)

I've attached another version.  It first adds the table headers to the array of table contents prior to examination.  Also, after some trial and error, I found that adding a constant of 11 pixels to the text width provides consistent results.  This can be seen by selecting the widest cell in the table (after column resizing) and changing the justification (left, center, right).  When changing the justification, the contents don't appear to change position.  This tells me that I've got an optimal column width.

 

Anyway, attached is a VI which uses two tables with identical contents.  It resizes the columns of one table using the original method, and resizes the other using the attached subVI, which uses a slightly modified approach.

Download All
Message 14 of 17
(4,703 Views)

I'm adding another version. I changed it back to Multicolumn Listbox and make the assumption that the longest string in characters is the longest in pixels. This provides a dramatic performance increase and should work fine if your fonts are consistent in each column.

 

-Jody

Message 15 of 17
(3,814 Views)

As long as this topic bubbled back up I will put in a shameless plug for this idea in the Idea Exchange.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 16 of 17
(3,802 Views)

Hi

 

I am printing a table in word document. All the columns are equally spaced irrespective of font size.

Due to that, the table is not fit into the page. If i click autofit contents or autofit windows, the table looks good.

 

How to do autofit contents in Word report generation when appending table to the word report??

 

I have attached the picture of MS-Word table.

 

Best regards,

Shree

0 Kudos
Message 17 of 17
(2,940 Views)