LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Program error when setting a table cell type to "string"

I have a program where the contents of several data sets can be displayed in a table. This usually works absolutely fine, but sometimes a program error occurs. This program error only occurs when the program is in a release configuration in a stand alone directory (installed with a distribution kit). Testing from within LW (either debug or release) works like a charm, copying the exact same exe file over the installed version generates the error when the program is run from there. I re-created the dist kit to ensure the same LW RTE is used, but to no avail.

Since there was no way to test this from within LW I included some printf lines in the code to see where the crash occurs. It seems to happen when the line
SetTableCellAttribute (hPanel, TABLEPANEL_TABLE, p, ATTR_CELL_TYPE, VAL_CELL_STRING);
is executed. Point p is within the range of table cells. Any ideas anyone?

CVI 6, BTW

Below is the full part of the code.



hPanel = LoadPanel (0, "SVPanels.uir", TABLEPANEL);

// define the maximum number of rows. Make it equal to the longest set to display
for (i=0; i < NrOfSets; i++) if (MaxNrOfElements < DS[i].NrOfElements) MaxNrOfElements = DS[i].NrOfElements;

// make the table empty
DeleteTableRows (hPanel, TABLEPANEL_TABLE, 1, -1);
DeleteTableColumns (hPanel, TABLEPANEL_TABLE, 1, -1);

// insert the nr. of rows equal to the longest data set
InsertTableRows (hPanel, TABLEPANEL_TABLE, -1, MaxNrOfElements, VAL_CELL_NUMERIC);

// fill the table with the data sets
for (i=0; i < NrOfSets; i++) {

// insert 2 columns, X and Y
InsertTableColumns (hPanel, TABLEPANEL_TABLE, -1, 2, VAL_CELL_NUMERIC);
NrOfCols += 2;

// Name the columns X1 Y1 X2 Y2 etc..
Fmt(LabelName, "%s<%s%i", "X", i+1);
SetTableColumnAttribute (hPanel, TABLEPANEL_TABLE, NrOfCols - 1, ATTR_USE_LABEL_TEXT, 1);
SetTableColumnAttribute (hPanel, TABLEPANEL_TABLE, NrOfCols - 1, ATTR_LABEL_TEXT, LabelName);
Fmt(LabelName, "%s<%s%i", "Y", i+1);
SetTableColumnAttribute (hPanel, TABLEPANEL_TABLE, NrOfCols, ATTR_USE_LABEL_TEXT, 1);
SetTableColumnAttribute (hPanel, TABLEPANEL_TABLE, NrOfCols, ATTR_LABEL_TEXT, LabelName);

// fill the columns with the data set values:
// DS[i].X is the X float array of data set i, allocated with malloc()
SetTableCellRangeVals (hPanel, TABLEPANEL_TABLE,
MakeRect (1, NrOfCols-1, DS[i].NrOfElements, 1), DS[i].X, VAL_COLUMN_MAJOR);
SetTableCellRangeVals (hPanel, TABLEPANEL_TABLE,
MakeRect (1, NrOfCols, DS[i].NrOfElements, 1), DS[i].Y, VAL_COLUMN_MAJOR);

// if the data set has fewer elements than the longest one,
// make the remaining column cells empty
if (DS[i].NrOfElements < MaxNrOfElements) {
Point p;

for (j=DS[i].NrOfElements + 1; j <= MaxNrOfElements; j++) {

p = MakePoint(NrOfCols-1, j);
printf("%i %i %i %i %i Val zero: ", j, NrOfCols, MaxNrOfElements, p.x, p.y);
SetTableCellAttribute (hPanel, TABLEPANEL_TABLE, p, ATTR_CTRL_VAL, 0);

printf("%i %i %i %i %i Type string: ", j, NrOfCols, MaxNrOfElements, p.x, p.y);

// ******* AT THIS POINT THE PROGRAM CRASHES ********
// ******* THE STRING ABOVE IS PRINTED AND THEN THE PROGRAM ERROR OCCURS ********

SetTableCellAttribute (hPanel, TABLEPANEL_TABLE, p, ATTR_CELL_TYPE, VAL_CELL_STRING);

printf("%i %i %i %i %i Val empty: ", j, NrOfCols, MaxNrOfElements, p.x, p.y);
SetTableCellAttribute (hPanel, TABLEPANEL_TABLE, p, ATTR_CTRL_VAL, "");
p = MakePoint(NrOfCols, j);
SetTableCellAttribute (hPanel, TABLEPANEL_TABLE, p, ATTR_CELL_TYPE, VAL_CELL_STRING);
SetTableCellAttribute (hPanel, TABLEPANEL_TABLE, p, ATTR_CTRL_VAL, "");

} // for (j=...)

} // if (DS[i].NrOfElements < MaxNrOfElements)

} // for (i=0; i
SetWaitCursor(0);
InstallPopup (hPanel);
0 Kudos
Message 1 of 3
(2,966 Views)
I am getting the same error it happens when I am calling data into a table and data into a Graph.  I get "xxx.exe" has generated errors and will be closed by Windows.  You will need to restart the program.  An error log is being created.  When I look at the event viewer logs there is no log of what happened no file created when the error occured.  Same with DrWatson log there is no entry when the error was created.  Any suggestions?
0 Kudos
Message 2 of 3
(2,905 Views)
Erwin,

If you are only seeing the problem on machines that you install the dist kit to (different machine than the one you developed/debugged the application on), I'd be curious if you have the same versions of the run-time engine on both machines.  If you ever updated the CVI run-time on your development machine, you could be distributing an older version than the one used when you run/debug your app on your dev machine. Compare the versions of cvirte.dll in the system32 directories; if they differ, that could be your problem.

Mert A.
National Instruments
0 Kudos
Message 3 of 3
(2,898 Views)