Sherlock, Ric wrote: > I have a form with a grid that displays different tables depending on > the selection in a list box. > The form also has "Flip" button that runs the flip__grid method. > > If I change the selected list box item so that the grid displays a table > that has a different row count to the first then the HdrRowWid is not > updated and still has the length from the previous table. > > That doesn't cause and immediate problem, but if I then try to flip the > table a length error is reported in initsizes[3] > >[3] wid=. (>./HdrTopHex,HdrRowHex+HdrRowPad), HdrColWid >. CellWid > because the lengths of HdrColWid and CellWid do not agree. My perusal > through the code suggests that HdrColWid is assigned from HdrRowWid > during the flip, but because the HdrRowWid is the wrong length the error > results. > > The problem does not surface where the tables have different column > lengths but the row lengths are the same because . > > I suspect this is a bug?
It is not clear whether this is a bug in the grid code or your app. A grid has a large number of state globals. Any time you change the size or type of data being viewed, you need to ensure these globals are all recalculated properly. The show verb should do this. However, for your app, the simplest way of selecting different tables to view is to erase the old grid, and start a new grid with each table. Alternatively, if you need to keep track of state for each table, then create a new grid for each table, keeping track of which grid matches which table. Then reassign the app global that points to the grid on change of table. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
