LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I automatically adjust the panel size to adjust to the number of rows in a table?

I have coded up a method which automatically inserts rows into a scrolled table. The table is the only thing on the panel. However, when I have a smaller number of rows in the table (say 5 rows) then I see a large empty white space under the 5 populated rows and the nonused scrollbar extends down another 6 inches. Does anyone know how to automatically adjust the table to show only 5 rows and make it look like a normal table with only the 5 rows and no white space underneath?
Thanks,
Donna
0 Kudos
Message 1 of 2
(2,807 Views)
Donna,

Try this attribute:

SetCtrlAttribute (panel, table, ATTR_NUM_VISIBLE_ROWS, 5);

It will size the table vertically to exactly fit the first 5 rows of the table, regardless of the height of each row. If the table has fewer than 5 rows, it will leave enough space for the remaining rows, based on how tall it "thinks" those additional rows will be.

If you ever change the height of one of the first 5 rows, you'll have to set this attribute again.

Also, if you're loading your table from the UI editor, you can configure this in the UI editor as well (from the Edit Table dialog, click on Size/Scroll Options, the check the Auto Size check box, and set the number of rows to 5).

Luis
NI
0 Kudos
Message 2 of 2
(2,796 Views)