04-19-2012 11:28 AM
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
Solved! Go to Solution.
04-19-2012 02:29 PM
Have you tried SetTableRowAttribute (..., ATTR_ROW_HEIGHT...)?
04-19-2012 02:51 PM
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);
}
04-20-2012 11:41 AM
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
04-20-2012 11:49 AM
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
04-23-2012 02:32 AM
Thank you