Hello! It was happened to me too... and
teh best (and simpliest) solution is to put BEFORE your loop the table
in invisibile state with :
SetCtrlAttribute (panelHandle, TAB_TABLE, ATTR_VISIBLE, 0);
end immediately AFTER
SetCtrlAttribute (panelHandle, TAB_TABLE, ATTR_VISIBLE, 1);
Of course the table cannot disappear, simply CVI runtime doesn't refresh
the screen for every attr or value changed. Of course you can't put a
call like ProcessSyestemEvent() or ProcessDrawEvent() in your loop.
Remember that you also optimize speed using functions that affect an
entire range of cells instead one a time like:
SetTableCellRangeAttribute (panelHandle, controlID,MakeRect (2, 3, 5,
5),cellAttribute,attributeValue);
hoping this helps
Ciao
Raf
Craig Leidholm wrote:
> I am trying to display data in a table as it's retrieved into my PC.
> I am sampling sequential channels and I need the data to be row-wise.
> Below is a snippit of code from the function that adds the data to the
> table.
>
> SetTableCellAttribute (nPanel, nTable, MakePoint(nCol,nRow),
> ATTR_CELL_TYPE,
> VAL_CELL_STRING);
> SetTableCellAttribute (nPanel, nTable, MakePoint(nCol,nRow),
> ATTR_CTRL_VAL,
> pIni->pScanInfo->m_szTime);
> nCol++;
> SetTableCellAttribute (nPanel, nTable, MakePoint(nCol,nRow),
> ATTR_DATA_TYPE,
> VAL_INTEGER);
> SetTableCellAttribute (nPanel, nTable, MakePoint(nCol,nRow),
> ATTR_CTRL_VAL,
> pIni->pScanInfo->m_nCurrentChannel);
>
> // Then put all the ion currents in to a string
> for (i=0; i
pScanInfo->m_nFinalMass -
> pIni->pScanInfo->m_nInitialMass + 1; i++)
> {
> nStatus = Fmt(szScan, "%s<%f",
> pIni->pScanInfo->m_dDataArray[i]);
> SetTableCellAttribute (nPanel, nTable,
> MakePoint(nCol,nRow),
> ATTR_DATA_TYPE,
> VAL_DOUBLE);
> SetTableCellAttribute (nPanel, nTable,
> MakePoint(nCol,nRow),
> ATTR_FORMAT,
> VAL_SCIENTIFIC_FORMAT);
> SetTableCellAttribute (nPanel, nTable,
> MakePoint(nCol,nRow), ATTR_CTRL_VAL,
> atof(szScan)
> );
> nCol++;
> }
>
> The for {} loop has to put 50-100 items in their cells, incrementing
> the column after each. I find that the for{} loop alone takes
> something on the order of 30 seconds to execute. Is there a more
> efficient way of doing this? Perhaps replacing the MakePoint()
> functions, which allocate memory each time they are called, with
> another method would speed things up?
>
> I need this whole function to finish in 1 second or so, not 30
> seconds. Is this possible, or is the table going to be forever a time
> burden on my app?
>
> Thanks,
>
> Craig