Fix para xbrowse + GoRight()

Fix para xbrowse + GoRight()

Postby Rossine » Tue Apr 17, 2007 4:26 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

Re: Fix para xbrowse + GoRight()

Postby Maurilio Viana » Tue Apr 17, 2007 5:18 pm

Olá, Rossine!

Uso somente xBrowse em meu programa e em muitas situações tenho esse problema de remontagem das colunas.
Tenho também problema da montagem das linhas na navegação pela vertical quando a altura do xBrowse não permite que a última linha seja visualizada por completo.
Vou testar suas correções!

Abraços!
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Rossine » Tue Apr 17, 2007 6:15 pm

Olá Maurilio,

Tenho também problema da montagem das linhas na navegação pela vertical quando a altura do xBrowse não permite que a última linha seja visualizada por completo.


Tente mudar o método abaixo para ver ser resolve este problema de apagar a ultima linha. Mudei somente a linha com "*"

Code: Select all  Expand view
METHOD GoUp() CLASS TXBrowse

   local nHeight

   if ::nLen == 0 .or. Eval( ::bBof )
      return nil
   endif

   ::CancelEdit()
   ::DrawLine()
   ::Seek()

   if Eval( ::bSkip, -1 ) == -1
      if ::nRowSel > 1
         ::nRowSel--
      else
         XBrwScroll( ::hWnd, -1, ::nRowHeight, ::nHeaderHeight, ::nFooterHeight )
         nHeight := ::BrwHeight() - ::FooterHeight() - ::HeaderHeight()
         If nHeight % ::nRowHeight > 0
*           ::EraseData( ( Int(nHeight/::nRowHeight) + 1 ) * ::nRowHeight )
            ::EraseData( ( ( Int(nHeight/::nRowHeight) + 1 ) * ::nRowHeight ) + 10 )
         Endif
         If ::nDataRows < ::RowCount()
            ::nDataRows++
         Endif
      endif
   endif


Abraços,

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

Postby Maurilio Viana » Tue Apr 17, 2007 8:28 pm

Beleza, Rossine.
Estou de mudança esta semana, tá uma correria, mas vou tentar testar à noite.

Obrigado!
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Rossini

Postby AOKISANTOS » Wed Apr 18, 2007 11:49 am

Rossini, uso o fwh 7.01, estes problemas reportados tambem estao nessa versão ?

Te agradeço...

Aokisantos :oops:
FWH25+XHARBOUR 99.50
AOKISANTOS
 
Posts: 210
Joined: Sun Jul 23, 2006 1:15 am

Postby Rossine » Wed Apr 18, 2007 12:39 pm

Olá Aoki,

> Rossini, uso o fwh 7.01, estes problemas reportados tambem estao nessa versão ?

Eu uso a versão de nov/05 mas acredito que devam sim funcionar para sua versão. Faça as mudanças que citei acima e veja se vai resolver ok ?

Abraços,

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

Postby Antonio Linares » Thu Apr 19, 2007 5:04 pm

Rossine,

Many thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Maurilio Viana » Thu Apr 19, 2007 6:07 pm

Rossine, tenho um xBrowse cujos dados vem de um array montados dinamicamente. Neste caso, quando as colunas ultrapassam a largura do browse e navego pra direita, quando deveria rolar para as colunas não visíveis ele não rola...
Vou ver se monto um exemplinho pra te demonstrar, o problema é que essa semana estou meio corrido, hehehehe
E aquele problema da navegação pra baixo não sarou ainda :-(

[ ]'s
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

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