> >Jay, Robert and Robin >> >>Thanks for the explanation guys - sorry I missed the bit in the reference >>manual. i rely too much on the examples some times. >> >>What this means of course is that an XREF array is ony really "dynamic" in >>one dimension, the other dimension is fixed at least as far as memory >>usage goes. >> >>I've been trying to work up a decent spreadsheet module that gives a full >>range of functionality (multiple sheets, resizable cells, formating etc.) >>and the 2D array was the easiest way to store the data. >> >>If I want this thing to be truely dynamic, with the size of the sheet set >>only by available memory then I will need to use a more complicated system >>for data storage. >> >>I can see a few ways to do this, but if anyone has any ideas I'd love to >>hear them. >> >> >>Thanks again >> >>David >> >>PS - Not really a beta issue, hence perhaps a private reply if you have >>any good ideas. >> >David, > >I've taken the liberty of moving this to the FB list and changing the >title. > >I think I would approach this as a dynamic array of dynamic arrays. Each >array would be single-dimensional, allowing complete flexibility. > >xref@ columnHndls(1) as handle >xref@ cells(1) as cellRecord >columnHndls = fn newhandle(currNnumberOfCols*sizeof(handle)) >for r = 0 to numberOfCols >columnHndls(r) = fn newhandle(currNumberOfRows*sizeof(cellRecord)) >next > >to access the row-5 cell in column 12: > >cells = columnHndls(12)'Set array to column 12 >myCellRec = cells(5)'Extract cell 5 > >Looks pretty easy to me. Of course you will have to determine what goes >into each cellRecord. When you change the size of the sheet, you just >change the size of the columnHndls handle to the appropriate number of >columns, then change the size of each cells handle to the new number of >rows. You can reference another sheet just by slipping a handle to a >different list of column handles into columnHndls! Slick. > >Let us know where you come out. > > 0"0 > =J= a y > " This was my first thought - but I also considered taking it a step further and making it a linked list. The advantage there is that it would be easy to insert or delete a column of data, or even move a column of data. The hard part is what to do with the other dimension, ie adding/deleting rows or even worse, moving a row. This would require moving all the data in an array of columns, which would be quite slow. Anyone see a way out for that one? Cheers David -- ----------------------------------------------------------------------- Dr David Cottrell School of Psychology James Cook University Let my words be as honey, for tomorrow I will probably have to eat them. -----------------------------------------------------------------------