Select Method in xbrowse

Select Method in xbrowse

Postby reinaldocrespo » Mon Dec 18, 2006 3:35 pm

Hi.

Working with the select method in xbrowse I've discovered that when noperation = 3 the code will not work because it presumes that the data is in natural order and thus it does not consider the posibility that it might indexed.

Code: Select all  Expand view
   case nOperation == 3 // Shift & lclick
      uBook   := Eval( ::bBookMark,, Self )
      uCurRow := Eval( ::bKeyNo,,Self )
      Eval( ::bBookMark,  Atail( ::aSelected ), Self )
      uOldRow := Eval( ::bKeyNo,,Self )

      if uOldRow != uCurRow
         ::aSelected := { Atail( ::aSelected ) }
         if uCurRow > uOldRow
            CursorWait()
            do while ( uTemp := Eval( ::bBookMark,, Self ) ) != uBook .and. !Eval( ::bEof, Self )
               If Ascan( ::aSelected, uTemp ) == 0
                  Aadd( ::aSelected, uTemp )
               Endif
               Eval( ::bSkip, 1, Self )
            enddo
            CursorArrow()
         else
            CursorWait()
            do while ( uTemp := Eval( ::bBookMark,, Self ) ) != uBook .and. !Eval( ::bBof, Self )
               If Ascan( ::aSelected, uTemp ) == 0
                  Aadd( ::aSelected, uTemp )
               endif
               Eval( ::bSkip, -1, Self )
            enddo
            CursorArrow()
         endif
         Aadd( ::aSelected, uBook )
         Eval( ::bBookMark, uBook, Self )
         ::lRefreshOnlyData := .t.
         If ::lCreated
            ::GetDC()
            ::Paint()
            ::ReleaseDC()
         endif
      else
         Eval( ::bBookMark, uBook, Self )
      endif



Notice how the line: if uCurRow > uOldRow compares actual record positions on the .dbf and not actual positions on the xbrowse so although uCurRow might actually be > uOldrow on the .dbf it might not be so on the browse being displayed.

Has anybody worked a solution to this problem?



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 71 guests