LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

row height in tables

Solved!
Go to solution

Hello,

 

I want to set the height of tables rows but I couldn't find the function or the right way to do it.

The table is in Column mode.

The row size mode is set to Use Explicit Size

 

First I remove all rows and columns and then the following code:

 

InsertTableColumns (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, 1, NbX_Points, VAL_USE_MASTER_CELL_TYPE);   

ColWidth = PlotAreaWidth / NbX_Points;  

SetTableColumnAttribute (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, -1, ATTR_COLUMN_WIDTH, ColWidth);  

InsertTableRows (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, 1, NbY_Points, VAL_USE_MASTER_CELL_TYPE);

 

What should I add for setting also the row heights?

 

Thank you

0 Kudos
Message 1 of 6
(3,889 Views)

Have you tried SetTableRowAttribute (..., ATTR_ROW_HEIGHT...)?

0 Kudos
Message 2 of 6
(3,882 Views)

I finally found the solution.

 

I did a mistake, by setting Size Mode to Use Explicit Size in the first row in the uir I thought it was the default value for all rows.

 

I think the documentation is not completely correct because it says that SetTableRowAttribute has no effect on existing cells but for the row height it has. That's the reason why I was looking to find a solution with SetTableCellRangeAttribute () as recommended.

I also tried with SetTableRowAttribute but because Size Mode was not correct it didn't work.

 

With this code it works:

for (i=1; i<=NbY_Points; i++)  

 {  

InsertTableRows (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, i, 1, VAL_USE_MASTER_CELL_TYPE);  

SetTableRowAttribute (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, i, ATTR_SIZE_MODE, VAL_USE_EXPLICIT_SIZE);  

SetTableRowAttribute (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, i, ATTR_ROW_HEIGHT, RowHeight);  

 }

0 Kudos
Message 3 of 6
(3,877 Views)

Okay, I understand your confusion.

 

The reason that that comment is there in the help is to make it clear that a table control has both row attributes and cell attributes, and it's important that users know that they are different. (If I recall, at some point, users were confused and though that they could set the cell attributes of an entire row by calling SetTableRowAttribute, which is not the case).

 

The comment says that SetTableRowAttribute "does not change the attributes of the existing cell". This is correct. But you are also correct when you note that changing the row height does have an effect on the individual cells. However, because the row height is a row attribute, not a cell attribute, the statement in the help is correct.

 

We'll try to find a way to reword this comment to make it clearer.

 

Luis

0 Kudos
Message 4 of 6
(3,866 Views)
Solution
Accepted by topic author Bertrand_ENAC

By the way, Bertrand, you don't have to use a loop if you don't want to. You could rewrite the code above as follows:

 

InsertTableRows (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, 1, NbY_Points, VAL_USE_MASTER_CELL_TYPE);  

SetTableRowAttribute (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, -1, ATTR_SIZE_MODE, VAL_USE_EXPLICIT_SIZE);  

SetTableRowAttribute (SA_ScatPosPanel, P_MULT_ROT_Z_TABLE, -1, ATTR_ROW_HEIGHT, RowHeight);

 

Luis

0 Kudos
Message 5 of 6
(3,862 Views)

Thank you

0 Kudos
Message 6 of 6
(3,849 Views)