Problem: 1381438

Title: (TGridView >32K) Check max number of rows and cols allowed before insertion.

Received: Aug 22 1996 2:58PM


If the column number is very large, the TGridView width in pixel could be over the long type range, and becomes negative. For example, when we call:
    (TGridView::) InsColLast(23000000, 150);]
The fColWidths->fTotal becomes negative in TGridView. The result is that nothing is drawn on window.

The same problem exists on large number of rows.


We may add the max range checks on TGridView::InsColBefore() and TGridView::InsRowBefore(); and maybe change the return value from void to boolean (or Error code) for TRunArray::InsertItems():
    if true (or noErr), insertion is successful,
    if false (or error code), insertion is falied.
Added range check. Added bool function result to all the Insxxx methods of TGridView and descendents.Ê
I think there are two problem in your fix.

1. Range check is only enabled if qDebugMsg is defined to 1

2. Total can be out of range if height of row or width of column is very big. You can check row number or column number.


OK we don't yet range check the pixels but we range check the number of columns at all times and only report with a programbreak on qDebugMsg and qRangeCheck