Twbrowse - error : Bound array access

xhbcoder
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Re: Twbrowse - error : Bound array access

Post by xhbcoder »

James Bott wrote:
I expect the N is either nRow or ::nColPos. However, since the error is not easy to generate, it will be very hard to find.

Perhaps it would be easier to switch to using xBrowse instead.

Hi James,

I also looked at xBrowse and wonder how our code can adapt. TWBrowes accepts a bunch of parameters while XBrowse needs only one. We built many user interfaces around Wbrowse in our 16 bit version and to rewrite them in 32 bit looks like a big chalenge.

One more question about the twbrowse, I can't determine which statement at line 152 access an array that triggers the error? Thank you.

I hope FWH delopers are looking into this.

Regards,

Jose
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Twbrowse - error : Bound array access

Post by James Bott »

Jose,
I also looked at xBrowse and wonder how our code can adapt. TWBrowes accepts a bunch of parameters while XBrowse needs only one. We built many user interfaces around Wbrowse in our 16 bit version and to rewrite them in 32 bit looks like a big chalenge.
Generally xBrowse requires much less code than TWBrowse. The fact that TWBrowse accepts a lot of parameters and xBrowse doesn't, doesn't mean that xBrowse cannot be used. I'm sure most or all of the parameters can be used in xBrowse just by direct assignment.

Code: Select all

METHOD New( nRow, nCol, nWidth, nHeight, bLine, aHeaders, aColSizes, oWnd,;
            cField, uVal1, uVal2, bChange, bLDblClick, bRClick,;
            oFont, oCursor, nClrFore, nClrBack, cMsg, lUpdate, cAlias,;
            lPixel, bWhen, lDesign, bValid, bLClick, aActions ) CLASS TWBrowse

You could even create a function to do this. Something like:

Code: Select all

function setupXBrowse(nRow, nCol, nWidth, nHeight, bLine, aHeaders, aColSizes, oWnd,;
            cField, uVal1, uVal2, bChange, bLDblClick, bRClick,;
            oFont, oCursor, nClrFore, nClrBack, cMsg, lUpdate, cAlias,;
            lPixel, bWhen, lDesign, bValid, bLClick, aActions, oBrw )

   oBrw:nRow := nRow
   oBrw:nCol := nCol
   oBrw:nHeight := nHeight
   ...
return nil
Note that I added oBrw as the last parameter. Now you can convert your wBrowse code even more easily.

Perhaps it just seems like a lot of work because you are not familiar with xBrowse. I suggest trying to convert a simple example of one of the TWBrowses in your code to see how it goes.
One more question about the twbrowse, I can't determine which statement at line 152 access an array that triggers the error?
There are only two arrays in the line, ::aColSizes and ::aJustify. However it is probably :bLogiclen which is defined like this in the setArray() method:

Code: Select all

   ::bLogicLen = { || ::nLen := Len( aArray ) }

However, as I said in a previous message, it really should be up to the programmer to make sure that bLogicLen is eval'd when the array length is changed. It would require way too much code in the TWBrowse source to check the array len each time bLogicLen was called. This would also slow down the browse itself.

Regards,
James
Post Reply