Fix para xbrowse + GoRight()

Fix para xbrowse + GoRight()

Postby Rossine » Tue Apr 17, 2007 4:27 pm

Olá,

Eu estava tendo alguns problemas com o xbrowse, quando se teclava a seta para direita, as colunas não eram mostradas na posição correta. Abaixo segue o fix (ou possível fix hehe) para isto. Pelo menos em todos os testes que fiz aqui funcionou 100%. Peço a quem usa o xbrowse fazer estas mudanças no arquivo XBROWSE.PRG e me digam se funciona para vocês também ok ? [:D]

Code: Select all  Expand view
//---------------------------------------------------------------------------//

METHOD IsDisplayPosVisible( nPos, lComplete ) CLASS TXBrowse

   local nWidth, nFor

   DEFAULT lComplete := .f.

   if nPos < 1 .or. nPos > len( ::aDisplay )
      return .f.
   endif

   if ::lRecordSelector
      nWidth := RECORDSELECTOR_WIDTH
   else
      nWidth := 0
   endif

   for nFor := 1 to nPos - 1
      nWidth += ::ColAtPos( nFor ):nWidth + COL_SEPARATOR
   next

   if lcomplete
      nWidth += ::ColAtPos( nPos ):nWidth + COL_SEPARATOR

      if nWidth > ::BrwWidth()    && By
Rossine - Reajusta a largura da coluna
         ::ColAtPos( nPos ):nWidth -= ( nWidth - ::BrwWidth() + COL_SEPARATOR )
      endif

   endif

return ( nWidth  < ::BrwWidth() )

//---------------------------------------------------------------------------//


Code: Select all  Expand view
//---------------------------------------------------------------------------//

METHOD GoRight( lOffset, lRefresh ) CLASS TXBrowse

   local nLen, nVis

   ::CancelEdit()

   if ::nMarqueeStyle == MARQSTYLE_NOMARQUEE .or. ::nMarqueeStyle >= MARQSTYLE_HIGHLROW
      lOffset := .t.
   endif

   DEFAULT lOffset  := .f.,;
           lRefresh := .t.

   nLen := len( ::aDisplay )
   nVis := 0

   Aeval( ::aCols, {|v| iif(!v:lHide, nVis++,) } )

   if ::ColAtPos( ::nColSel ):nCreationOrder < LEN(::aCols)    && By Rossine
      if     ::ColAtPos( ::nColSel+1 ):nCreationOrder = LEN(::aCols)
             if LEN(::aCols) <= ::LastDisplayPos( .f. )
                ::nColSel++
                if lRefresh
                   ::DrawLine( .t. )
                endif
             else
                ::GoRightMost()
             endif

* Linha Original de xbrowse
*     if     ( !lOffset .and. ::nColSel <= ::LastDisplayPos( .t. ) .and. ::nColSel < nLen ) .or. ;
*            ( ::nColOffset == ( nLen - ::nFreeze + 1 ) .and. ::nColSel < nLen )

      elseif ( !lOffset .and. ::nColSel+1 <= ::LastDisplayPos( .t. ) .and. ::nColSel <= nLen ) .or. ;
             ( ::nColOffset == ( nLen - ::nFreeze + 1 ) .and. ::nColSel < nLen )
             ::nColSel++
             if lRefresh
                ::DrawLine( .t. )
             endif

&& Linha Original de xbrowse
*     elseif ::nColOffset < ( nVis - ::nFreeze )

      elseif ::nColOffset < ( nVis - ::nFreeze ) .and. ::ColAtPos( ::nColSel ):nCreationOrder <= LEN(::aCols)
     
             ::nColOffset := Min( ::nColOffset + 1, nVis - ::nFreeze )
             ::GetDisplayCols()
             if lRefresh
                ::Super:Refresh( .f. )
             endif

            ::IsDisplayPosVisible( ::nColSel, .t. )  && By Rossine
                                                     && Isto e' necessario para se ajustar a largura
                                                     && da ultima coluna visualizada a direita.
      endif

      if ::oHScroll != nil
         ::oHScroll:GoDown()
      endif
   endif

return nil

//----------------------------------------------------------------------------//



Obrigado,

Rossine.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests