Hello Przemek

How this error can be generated:
Open any TBrowse. I did with tests/wvtext.prg <F10>.

Scroll down with down-arrow past last line by two records.
Scroll up with up-arrow past first record.
Scroll down with down-arrow and at stay at last row for a moment - just to
be sure.
Scroll down -  AND ERROR WILL BE GENERATED.

I do not know the logic so I did not dwelled deep.

IMETHOD stabilize() CLASS TBROWSE

   LOCAL nCol, nRowCount, nToMove, nMoved
   LOCAL lDisp, lRead, lStat

   IF ::nConfigure != 0
      ::doConfigure()
   ENDIF

   IF !::lStable .OR. ::lInvalid .OR. ::lFrames .OR. ::lRefresh .OR. ;
      ::nMoveOffset != 0 .OR. ::nBufferPos != ::nRowPos

      nRowCount := ::rowCount

      IF ::lRefresh
         AFill( ::aCellStatus, .F. )
         ::nLastRow := nRowCount
         ::nLastScroll := 0
         ::lRefresh := .F.
      ENDIF

      nCol := ::nColPos
      IF nCol < 1 .OR. nCol > ::colCount .OR. ::nLastPos != nCol .OR. ;
         ::lFrames .OR. ::nLeftVisible == 0 .OR. ::nRightVisible == 0 .OR. ;
         ::aColData[ nCol ][ _TBCI_COLPOS ] == NIL

         ::setVisible()
      ENDIF

      IF ::lFrames
         ::dispFrames()
         AFill( ::aDispStatus, .T. )
      ENDIF

      lRead := .F.
      IF ::nMoveOffset != 0
         ::setPosition()
         lRead := .T.
      ENDIF
hb_ToOutDebug( "stabilize: 5" )
      IF ::nLastScroll > 0
         FOR EACH lStat, lDisp IN ::aCellStatus, ::aDispStatus DESCEND
hb_ToOutDebug( "stabilize: 5 1 0" )
            IF !lStat       //////////    ERROR: CONDITIONAL   
/////////////
hb_ToOutDebug( "stabilize: 5 1 1" )
               IF lRead
hb_ToOutDebug( "stabilize: 5 1 2" )
                  RETURN .F.
               ENDIF
               lRead := ::readRecord( lStat:__enumIndex() )
            ENDIF
            IF lDisp
               ::dispRow( lDisp:__enumIndex() )
            ENDIF
         NEXT
hb_ToOutDebug( "stabilize: 5 1" )
      ELSE
         FOR EACH lStat, lDisp IN ::aCellStatus, ::aDispStatus
            IF !lStat
               IF lRead
                  RETURN .F.
               ENDIF
               lRead := ::readRecord( lStat:__enumIndex() )
            ENDIF
            IF lDisp
               ::dispRow( lDisp:__enumIndex() )
            ENDIF
         NEXT
hb_ToOutDebug( "stabilize: 5 2" )
      ENDIF
hb_ToOutDebug( "stabilize: 6" )
      IF ::nRowPos > ::nLastRow
         ::nRowPos := ::nLastRow
      ENDIF
      IF ::nBufferPos != ::nRowPos
         /* TOFIX: add protection against unexpected results
          *        CA-Cl*pper does not fully respect here the returned
          *        value and current code below replicates what Clipper
          *        seems to do but it means that in network environment
          *        with concurent modifications wrong records can be
          *        shown. [druzus]
          */
         nToMove := ::nRowPos - ::nBufferPos
         nMoved := _SKIP_RESULT( Eval( ::bSkipBlock, nToMove ) )
         IF nToMove > 0
            IF nMoved < 0
               nMoved := 0
            ENDIF
         ELSEIF nToMove < 0
            nMoved := nToMove
         ELSE
            nMoved := 0
         ENDIF
         ::nBufferPos += nMoved
         ::nRowPos := ::nBufferPos
      ENDIF
      ::lStable := .T.
      ::lInvalid := .F.
   ENDIF

   IF ::autoLite
      ::hilite()
   ELSE
      ::setCursorPos()
   ENDIF

   RETURN .T.

Regards
Pritpal Bedi

-- 
View this message in context: 
http://www.nabble.com/A-Bug-in-TBrowse-Class-tp20169788p20169788.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to