05-08-2014 09:54 AM
Hello,
I would like to clear up cell values for table updating with next values.
Is there any way to clean up the previous values(or reset cell values) at the table ?
Do I have set the all cell values to default ?
My issue is the following.
The "strmConfCnt" (below code) is being changed while updating tables.
If the number of previous table rows are bigger(for example, 6) than the updating sets(for example, 4), then the table shows up the pervious 2 unwanted rows data.
*please refer to the attached screen shot for the result.(The row 5 and row 6 from the previous data set are not wanted to show.)
Thank you,
Insuk
The part of Code --------------------------------------------------------------------
for ( strmidx =0; strmidx < strmConfCnt; strmidx++) {
SetTableCellAttribute (mDisplayHandle, PoutData4_Port6Tab,MakePoint(1,1+strmidx), ATTR_CTRL_VAL,SioInfo[strmidx].sensor);
SetTableCellAttribute (mDisplayHandle, PoutData4_Port6Tab,MakePoint(4,1+strmidx), ATTR_CTRL_VAL,configInfo[index].rate6);
}
Solved! Go to Solution.
05-08-2014 10:31 AM
If your table has the same data type on each cell you can use FillTableCellRange with range VAL_TABLE_ENTIRE_RANGE.
Since as I see your table has different data types (at least column 1 is a string, other columns appears to be all numbers) you must issue the command with different ranges. Macros VAL_TABLE_COLUMN_RANGE(c) and VAL_TABLE_ROW_RANGE(r) are useful in this respect. If the range is not a single column or row you can embed MakeRect () in the command to set the appropriate range.
All those macros are defined in userint.h.
05-08-2014 10:57 AM
Hello Roberto,
It is clear answer. It seems there is no way to clean up from the existing table to the empty table.
I would like to accept it as a solution and to use "VAL_TABLE_COLUMN_RANGE".
Your answer is very helpful.
Thank you so much,
Insuk
05-09-2014 01:34 AM
I have realized just now that probably the easiest way to obtain your goal is to simply delete all rows from the table and recreate them: if the table is in column mode and your pass VAL_USE_MASTER_CELL_TYPE as Cell Type parameter in InsertTableRows you will have a set of rows initialized with the default value set for each column.
05-09-2014 09:22 AM
Hello Roberto,
Thank you for your time and effort.
It is another smart way to implement. I would like to keep this way in mind.
Thank you again,
Insuk
09-17-2014 11:09 AM
@RobertoBozzolo wrote:
If your table has the same data type on each cell you can use...
So I have a table with different cell data types and I too need to be able to clear out an entire row at any given time. Here's how I solved this: using the default values for each cell, which in most cases don't even have to be set first. In my case, I only was dealing with three unique data types, so you would extend this function as you need:
int cellDataType; int defaultIntVal; float defaultFloatVal; char defaultStrVal[5]; int row = 1; // this would be a parameter passed into this function #define MAX_COLS 23 // this is the number of columns in your table for (int column=1; column<MAX_COLS; column++) { // first lookup the cell type GetTableCellAttribute(panelHandle,TABLE_CTRL,MakePoint(column,row),ATTR_DATA_TYPE,&cellDataType); switch (cellDataType) { case VAL_UNSIGNED_INTEGER: // then retrieve the default value GetTableCellAttribute(panelHandle,TABLE_CTRL,MakePoint(column,row),ATTR_NUM_CELL_DFLT_VALUE,&defaultIntVal); // finally set the default value SetTableCellVal(panelHandle,TABLE_CTRL,MakePoint(column,row),defaultIntVal); break; case VAL_FLOAT: // then retrieve the default value GetTableCellAttribute(panelHandle,TABLE_CTRL,MakePoint(column,row),ATTR_NUM_CELL_DFLT_VALUE,&defaultFloatVal); // finally set the default value SetTableCellVal(panelHandle,TABLE_CTRL,MakePoint(column,row),defaultFloatVal); break; case VAL_UNSIGNED_CHAR: // then retrieve the default value GetTableCellAttribute(panelHandle,TABLE_CTRL,MakePoint(column,row),ATTR_STR_CELL_DFLT_VALUE,defaultStrVal); // finally set the default value SetTableCellVal(panelHandle,TABLE_CTRL,MakePoint(column,row),defaultStrVal); break; } }