From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetTableCellRangeVals() returned -55 "The index passed is out of range"


The SetTableCellRangeVals() line below broke out at runtime and returned error -55.

I verified PANEL_table was "Hot" (from another post), and reran the application, but got the same error.

I verified picture values and size/ranges as valid (13).

I looked at VAL_TABLE_ENTIRE_RANGE = MakeRect(1,1,VAL_TO_EDGE,VAL_TO_EDGE), where VAL_TO_EDGE=-1. 
- I assume (-1) determines size of array (13) and sets range to that value.

I debuged the line just before executing SetTableCellRangeVals() and the pixel values of "picture" is valid (well, non-zero).

   int *picture = NULL;
   picture = malloc ( 13 * 13 * sizeof(int) );
   memset( picture, 0, 13 * 13 * sizeof(int) ); // initially zeros
   // changed pixel values ...
   SetTableCellRangeVals( panel, PANEL_table, VAL_TABLE_ENTIRE_RANGE, picture, VAL_ROW_MAJOR );

What else should I be verifying?
0 Kudos
Message 1 of 3
(3,006 Views)
You get the error below if you don't have any cells in the table at the time that you call SetTableCellRangeVals. Before you can configure the cells, you have to create them, using InsertTableRows and InsertTableColumns (unless you created them ahead of time in the user interface editor).

Also, is your goal to create 169 (13 x 13) different images in the table? The array that you pass to that function is intended to represent the new values of each cell in the range. If the cells are of type picture, then each value should be a bitmap object. If your goal is instead to set a single picture, where each item in the array is really a pixel, then you need to first create a bitmap object, using the NewBitmapEx function. You should then use that bitmap to modify a single cell in the table, using SetTableCellVal.

Luis
0 Kudos
Message 2 of 3
(2,991 Views)
Great!  That worked. 

I made the table large enough (had some real-estate problems but its ok) and added 13 columns and 13 rows of INTEGERS in the GUI editor, and that fixed my problem.

For some reason, I was thinking that by making the SetTableCellRangeVals() call, it was going to allocate/create the 13x13xINT location for me.
0 Kudos
Message 3 of 3
(2,984 Views)