LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetTableCellRangeVals is very slow

Solved!
Go to solution

Hello,

 

I'm using SetTableCellRangeVals in order to fill a table (6 string columns, 1 numeric column and 250 rows). 

 

First, I load the panel, I fill the table, and I display the panel. The time to display the table is very fast. The problem occurs when I update this table, the time to display all values is very long (4 or 5 s)

 

How can i do to reduce this time ?

 

For the moment, my program is :

 

 

 

 

while (compt < 250)
{
  strcpy(sTexte[0],sDate);
  strcpy(sTexte[1],sType);
  strcpy(sTexte[2],sEtat);
  strcpy(sTexte[3],sMessage);
  strcpy(sTexte[4],sMessage2);
  strcpy(sTexte[4],sTest);
 
  SetTableCellRangeVals (giPanelRapports, JOURNAL_TABLE, MakeRect (compt+1, 1 , 1, 6), sTexte, VAL_ROW_MAJOR);
  SetTableCellRangeVals (giPanelRapports, JOURNAL_TABLE, MakeRect (compt+1, 7 , 1, 1), &iRef, VAL_ROW_MAJOR);
 
  if(strcmp("test1",sEtat)==0)
  {   
      	SetTableCellRangeAttribute(giPanelRapports,JOURNAL_TABLE,MakeRect (compt+1, 1 , 1, 7),ATTR_TEXT_COLOR,giCouleurTexteJournal[i][0]);                                 	SetTableCellRangeAttribute(giPanelRapports,JOURNAL_TABLE,MakeRect (compt+1, 1 , 1, 7),ATTR_TEXT_BGCOLOR,giCouleurFondJournal[i][0]);      
  }
  if(strcmp("test2",sEtat)==0)  
  {
      	SetTableCellRangeAttribute(giPanelRapports,JOURNAL_TABLE,MakeRect (compt+1, 1 , 1, 7),ATTR_TEXT_COLOR,giCouleurTexteJournal[i][1]);                                 	SetTableCellRangeAttribute(giPanelRapports,JOURNAL_TABLE,MakeRect (compt+1, 1 , 1, 7),ATTR_TEXT_BGCOLOR,giCouleurFondJournal[i][1]);  
  }
 
  compt++;
}  

 

 

 

 

 

Thanks a lot

 

Benjamin

 

0 Kudos
Message 1 of 3
(3,742 Views)
Solution
Accepted by topic author Benjamin.J

The usual tricks that can improve table performance are to set another control as the active control while updating the table and to hide the table itself before accessing it.

 

Additionally, I would try converting the program so that values are written in columns, which will reduce the numer of updates to 7 instead of 250.

Another attempt could be to examine update time with and without setting cell colors



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,735 Views)

 

Thanks a lot for your answer. 
I just set the control invisible before loading data, and it works 
very well. The data are loaded from a database, for the moment, I 
prefer fill the table by row. 
Thank you very much for your help.

 

Thanks a lot for your answer. 


I just set the control invisible before loading data, and it works very well. The data are loaded from a database, for the moment, I prefer fill the table by row.

 
Thank you very much for your help.

 

Benjamin

0 Kudos
Message 3 of 3
(3,720 Views)