Para Antonio: xBrowse nFreeze (APORTE)

Para Antonio: xBrowse nFreeze (APORTE)

Postby FranciscoA » Sun May 19, 2013 12:10 am

Antonio.
Vista la necesidad de un colega, expuesta aquí en el foro, y, por supuesto, la mía propia, viewtopic.php?f=6&t=26312#p144716 , me he puesto a trabajar en una solución, la cual creo que he encontrado.

La he probado bastante y no me ha dado ninguna falla.
Ahora el Method GoLeft() Class TXBrowse, detecta si se está utilizando columnas congeladas, y se comporta como lo necesitamos. Si al avanzar hacia la derecha, se ocultan columnas por las congeladas, al regresar hacia la izquierda y llegar a la primer columna despues de la nFreezed y se continua avanzando hacia la izquierda, van apareciendo las ocultas, mientras el cursor se mantiene en la misma columna, hasta que aparece la No. 1 despues de las congeladas, y hasta entonces continua avanzando sobre las congeladas. Aqui el codigo original, y el modificado por tu servidor.

//----------------------------------------------------------------------------//
/*
METHOD GoLeft( lOffset, lRefresh ) CLASS TXBrowse

::CancelEdit()

if ::nMarqueeStyle == MARQSTYLE_NOMARQUEE .or. ( ::nMarqueeStyle >= MARQSTYLE_HIGHLROW .and. ::bClrRowFocus == nil )
lOffset := .t.
endif

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

if ( !lOffset .and. ::IsDisplayPosVisible( ::nColSel - 1 ) ) .or. ;
( ::nColOffset == 1 .and. ::nColSel > 1 )
::nColSel--
if lRefresh
if ::FullPaint()
::Super:Refresh( .t. )
else
::DrawLine( .t. )
endif
endif
elseif ::nColOffset > 1
::nColOffset--
::GetDisplayCols()
if lRefresh
::Super:Refresh( ::FullPaint() )
endif
endif

if ::oHScroll != nil
::oHScroll:GoUp()
endif
::Change( .f. )

return nil
*/


Code: Select all  Expand view
//-----------------------------------------------------
//Method GoLeft() modified by Francisco J. Alegría P. - May 18, 2013
//------------------------------------------------------
METHOD GoLeft( lOffset, lRefresh )  CLASS TXBrowse
local oFirstCol

   ::CancelEdit()

   if ::nMarqueeStyle == MARQSTYLE_NOMARQUEE  .or. ( ::nMarqueeStyle >= MARQSTYLE_HIGHLROW .and. ::bClrRowFocus == nil ) ;
      .or. ::nFreeze > 0
      lOffset := .t.
   endif

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

IF !lOffset

   if ( ::IsDisplayPosVisible( ::nColSel - 1 ) ) .or. ;
      ( ::nColOffset == 1 .and. ::nColSel > 1 )
      ::nColSel--
      if lRefresh
         if ::FullPaint()
            ::Super:Refresh( .t. )
         else
            ::DrawLine( .t. )
         endif
      endif
   elseif ::nColOffset > 1
      ::nColOffset--
      ::GetDisplayCols()
      if lRefresh
         ::Super:Refresh( ::FullPaint() )
      endif
   endif

ELSE

   if ::SelectedCol():nCreationOrder == 1
      return nil
   endif

   oFirstCol := if ( ::nFreeze > 0, ::aCols[::nFreeze+1], ::aCols[1] )

   if ::IsDisplayPosVisible( oFirstCol:nPos, .t. )
      ::nColSel--
      if lRefresh
         ::Super:Refresh( .t. )
      endif

   else
      ::nColSel--
      if lRefresh
         ::Super:Refresh( .t. )
      endif

      if ::nColSel == ::nFreeze
         ::GoRight()
         ::nColOffSet--
         ::GetDisplayCols()
         if lRefresh
            ::Super:Refresh( ::FullPaint() )
         endif
         if ::oHScroll != nil
            ::oHScroll:GoUp()
         endif
      endif
   endif

ENDIF

   if ::oHScroll != nil
      ::oHScroll:GoUp()
   endif
   ::Change( .f. )

return nil
 

Espero que sea de utilidad.
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2135
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Para Antonio: xBrowse nFreeze (APORTE)

Postby rolando » Sun May 19, 2013 3:02 pm

Francisco,

Muy bueno lo tuyo.

Lo probé en mi sistema y funciona bien en casi todos los casos.

Pero tengo un xBrowse de 5 columnas en el cual hago un freeze en la columna 5 (para que no se vaya del dialog por recursos al darle a la flechita derecha).

Ahí daba un error cuando se quería volver hacia la izquierda (le suma 1 a la columna cuando ::nFreeze > 0 y, justo el freeze está en la última columna del xBrowse).

Le hice una pequeña reforma a lo tuyo y pongo a tu consideración, acá me funciona correcto.

Code: Select all  Expand view
//  oFirstCol := if ( ::nFreeze > 0, ::aCols[::nFreeze+1], ::aCols[1] )

     oFirstCol := if ( ::nFreeze > 0 .and. ::nFreeze<len(::aCols), ::aCols[::nFreeze+1], ::aCols[1] )


Saludos.

Rolando :D
User avatar
rolando
 
Posts: 593
Joined: Sat May 12, 2007 11:47 am
Location: San Nicolás - BA - ARGENTINA

Re: Para Antonio: xBrowse nFreeze (APORTE)

Postby FranciscoA » Sun May 19, 2013 8:19 pm

Rolando,
Es correcto. He integrado tu modificacion.
Code: Select all  Expand view
//-----------------------------------------------------
//Method GoLeft() modified by Francisco J. Alegría P. - May 18, 2013
//------------------------------------------------------
METHOD GoLeft( lOffset, lRefresh )  CLASS TXBrowse
local oFirstCol

   ::CancelEdit()

   if ::nMarqueeStyle == MARQSTYLE_NOMARQUEE  .or. ( ::nMarqueeStyle >= MARQSTYLE_HIGHLROW .and. ::bClrRowFocus == nil ) ;
      .or. ::nFreeze > 0
      lOffset := .t.
   endif

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

IF !lOffset

   if ( ::IsDisplayPosVisible( ::nColSel - 1 ) ) .or. ;
      ( ::nColOffset == 1 .and. ::nColSel > 1 )
      ::nColSel--
      if lRefresh
         if ::FullPaint()
            ::Super:Refresh( .t. )
         else
            ::DrawLine( .t. )
         endif
      endif
   elseif ::nColOffset > 1
      ::nColOffset--
      ::GetDisplayCols()
      if lRefresh
         ::Super:Refresh( ::FullPaint() )
      endif
   endif

ELSE

   if ::SelectedCol():nCreationOrder == 1
      return nil
   endif

   //oFirstCol := if ( ::nFreeze > 0, ::aCols[::nFreeze+1], ::aCols[1] )
   oFirstCol := if ( ::nFreeze > 0 .and. ::nFreeze < len(::aCols), ::aCols[::nFreeze+1], ::aCols[1] )  //Rolando

   if ::IsDisplayPosVisible( oFirstCol:nPos, .t. )
      ::nColSel--
      if lRefresh
         ::Super:Refresh( .t. )
      endif

   else
      ::nColSel--
      if lRefresh
         ::Super:Refresh( .t. )
      endif

      if ::nColSel == ::nFreeze
         ::GoRight()
         ::nColOffSet--
         ::GetDisplayCols()
         if lRefresh
            ::Super:Refresh( ::FullPaint() )
         endif
         if ::oHScroll != nil
            ::oHScroll:GoUp()
         endif
      endif
   endif

ENDIF

   if ::oHScroll != nil
      ::oHScroll:GoUp()
   endif
   ::Change( .f. )

return nil
 

Gracias por ayudarme a depurar el codigo.
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2135
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Para Antonio: xBrowse nFreeze (APORTE)

Postby Antonio Linares » Mon May 20, 2013 2:18 pm

Francisco, Rolando,

Incluido para el próximo build, muchas gracias! :-)
regards, saludos

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

Re: Para Antonio: xBrowse nFreeze (APORTE)

Postby AIDA » Fri May 24, 2013 2:35 am

Muy bueno :mrgreen:

Muchos tenquius :D


Saluditos :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 877
Joined: Fri Jan 12, 2007 8:35 pm

Re: Para Antonio: xBrowse nFreeze (APORTE)

Postby nageswaragunupudi » Mon May 27, 2013 3:35 pm

Mr FranciscoA

To get what you want I suggest a very simple modification to the existing code.
I have inserted 3 lines of code. You can see below:

Code: Select all  Expand view
METHOD GoLeft( lOffset, lRefresh )  CLASS TXBrowse

   ::CancelEdit()

   if ::nMarqueeStyle == MARQSTYLE_NOMARQUEE  .or. ( ::nMarqueeStyle >= MARQSTYLE_HIGHLROW .and. ::bClrRowFocus == nil )
      lOffset := .t.
   endif

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

   // Begin insert new code
   if ::nFreeze > 0 .and. ::nColOffSet > 1 .and. ::nColSel == ::nFreeze + 1
      lOffset := .t.
   endif
   // end of inserted code

   if ( !lOffset .and. ::IsDisplayPosVisible( ::nColSel - 1 ) ) .or. ;
      ( ::nColOffset == 1 .and. ::nColSel > 1 )
      ::nColSel--
      if lRefresh
         if ::FullPaint()
            ::Super:Refresh( .t. )
         else
            ::DrawLine( .t. )
         endif
      endif
   elseif ::nColOffset > 1
      ::nColOffset--
      ::GetDisplayCols()
      if lRefresh
         ::Super:Refresh( ::FullPaint() )
      endif
   endif

   if ::oHScroll != nil
      ::oHScroll:GoUp()
   endif
   ::Change( .f. )

return nil

 

Can you please try this?
In my tests this is working satisfactorily.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10356
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Para Antonio: xBrowse nFreeze (APORTE)

Postby FranciscoA » Tue May 28, 2013 1:40 am

Mr nageswaragunupudi,
Yes, I've done some tests and your code is working fine for me. I modified mine.
Thank you for your attention.

Si, hice algunas pruebas y su código está bien, para mi. He cambiado el mio.
Gracias por su atención.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2135
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests