Q:  I'm trying to add a cell to a matrix or column of a browser that has already been loaded.  I think I'm performing the right steps.  I'm even explicitly calling a redisplay but the matrix never shows the new cell.  What's going on?

A:  When you add cells, the matrix needs to grow to a new size to accommodate them. Most likely the cells are being added, but without resizing the matrix, the new cells are being clipped from view.  After adding cells, be sure to call sizeToCells (or sizeToFit depending on which you want) so the matrix will resize and you can see the new cells.

Here is code fragment that shows adding a cell to an already loaded column of a browser:



id matrix,cell;
int row;

matrix = [browser matrixInColumn:0];
[matrix getNumRows:&row numCols:NULL];
[matrix addRow];
cell = [matrix cellAt:row  :0];
[cell setStringValue:"New Cell"];
[cell setLoaded:YES];
[cell setLeaf:YES];
[matrix sizeToCells];    <<--- Don't forget this!!



QA852

Valid for 1.0,  2.0, 3.0, 3.1