FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour xBrowse: problema con Copy/Paste
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
xBrowse: problema con Copy/Paste
Posted: Tue Sep 10, 2013 12:17 AM
Al equipo de FiveWin:

Al copiar celdas en xBrowse todo Ok, salvo cuando son DATE.

Ejemplo:
si copio '31/01/2013'
al pegar este dato a otra celda tipo DATE aparentemente no copia nada.

El problema esta en el siguiente codigo:
Code (fw): Select all Collapse
METHOD ClpText() CLASS TXBrwColumn
:
:
      elseif ::cDataType == 'D'

         cDtFmt    := Set( _SET_DATEFORMAT )
         Set( _SET_DATEFORMAT, "YYYY-MM-DD" )
         RetVal   := DTOC( RetVal )
         Set(_SET_DATEFORMAT, cDtFmt )
:
:
return RetVal


ejemplo:
'31/01/2013' lo convierte a: '2013-01-31'

y al hacer el pegado (PASTE), uCharToVal( '2013-01-31', @cType ) devuelve vacio (" / / ").
Code (fw): Select all Collapse
METHOD Paste( cText ) CLASS TXBrwColumn
   if ::cDataType $  'CM'
      :
   else
      uNew        := uCharToVal( cText, @cType )
      endif
   endif
return nil


Esto se debe a que uCharToVal( ) hace la conversion por medio de dCharToDate( cDate ) y dCharToDate( )
tiene este codigo:
Code (fw): Select all Collapse
static function dCharToDate( cDate )
:
:
      Set( _SET_DATEFORMAT, If( cc == 'dd', 'mm/dd/yy', 'dd/mm/yy' ) )
      dDate := CToD( cDate )
:
:
return dDate


"YYYY-MM-DD" y If( cc == 'dd', 'mm/dd/yy', 'dd/mm/yy' ) son formatos de fechas incompatibles.
es decir CToD( "2013-01-31" ) -> ' / / '

Para corregir el problema, se podria cambiar el metodo PASTE
Code (fw): Select all Collapse
METHOD Paste( cText ) CLASS TXBrwColumn

   local uNew, cType

   if ::cDataType $  'CM'
      if Eval( ::oBrw:bLock )
         ::Value     := Trim( cText )
         Eval( ::oBrw:bUnLock )
      endif
   elseif ::cDataType $  'D'                     //<--- aca el cambio ....
      uNew        := STOD(strtran( cText, "-" ))
            if EVal( ::oBrw:bLock )
               ::Value  := uNew
               Eval( ::oBrw:bUnlock )
            endif                                //....hasta aca.
   else
      uNew        := uCharToVal( cText, @cType )
      if uNew != nil
         if ::cDataType == nil .or. ::cDataType == cType
            if EVal( ::oBrw:bLock )
               ::Value  := uNew
               Eval( ::oBrw:bUnlock )
            endif
         endif
      endif
   endif

return nil


Espero su opinion.

Atentamente,

Rolando
Cochabamba - Bolivia
FWH 1109 - xHarbour 1.1.0 (SimpLex) - BCC58
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: problema con Copy/Paste
Posted: Tue Sep 10, 2013 02:23 PM

uCharToVal( '2013-01-31' ) returns correct date in the present versions.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion