FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour GET y PASTE ( SOLUCIONADO )
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
GET y PASTE ( SOLUCIONADO )
Posted: Fri Mar 20, 2009 03:39 PM

Estimados

Como evitar que en un GET al presionar el boton derecho del mouse y presionar PASTE este modifique el largo de la cadena

me explico , si una variable caracter deseo que sea maximo de 17, el problema es si hacen paste este se empieza agrandar tantas veces
que uno hace paste, el problema esta en boton derecho del mouse y PEGAR, la opcion CTRL+V funciona bien

alguien a solucionado esto

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: GET y PASTE
Posted: Sun Mar 22, 2009 10:03 AM
Patricio,

Por favor modifica asi el Método Paste() de la Clase TGet y comprueba si te funciona bien, gracias
Code (fw): Select all Collapse
METHOD Paste( cText ) CLASS TGet

   local oClp, cTemp, nLen

   DEFINE CLIPBOARD oClp OF Self FORMAT TEXT

   if cText == nil
      if oClp:Open()
         cText = oClp:GetText()
         oClp:Close()
      else
         MsgAlert( "The clipboard is not available!" )
      endif
   endif

   if ! Empty( cText )
      cTemp = ::GetText()
      nLen = Len( ::oGet:Buffer )
      
      do case
         case ValType( cTemp ) == "C"
              ::oGet:Buffer = SubStr( cTemp, 1, ::nPos - 1 ) + Trim( cText ) + ;
                        SubStr( cTemp, ::nPos )

         case ValType( cTemp ) == "N"
              cTemp = cValToChar( cTemp )
              ::oGet:Buffer = Val( SubStr( cTemp, 1, ::nPos - 1 ) + Trim( cText ) + ;
                             SubStr( cTemp, ::nPos ) )

         case ValType( cTemp ) == "D"
              cTemp = cValToChar( cTemp )
              ::oGet:Buffer = CToD( SubStr( cTemp, 1, ::nPos - 1 ) + Trim( cText ) + ;
                              SubStr( cTemp, ::nPos ) )
      endcase
 
      ::oGet:Buffer = Pad( ::oGet:Buffer, nLen )          

      ::DispText() // from buffer to screen

      if ::bChange != nil
         Eval( ::bChange,,, Self )
      endif
      
      if ::oBtn != nil
         ::oBtn:Refresh()
      endif   

   endif

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: GET y PASTE
Posted: Sun Mar 22, 2009 10:36 PM
Patricio,

Prueba cambiando en el metodo HandleEvent este CASE

Code (fw): Select all Collapse
      case nMsg == WM_PASTE
           if GetFocus() == ::hWnd
              CallWindowProc( ::nOldProc, ::hWnd, WM_PASTE, 0, 0 )
              ::oGet:buffer = Pad( GetWindowText( ::hWnd ), Len( ::oGet:buffer ) )
              SetWindowText( ::hWnd, ::oGet:buffer )  // new line
              DEFINE CLIPBOARD oClp OF Self FORMAT TEXT
              ::oGet:Pos += Len( oClp:GetText() )
              oClp:End()
              ::oGet:Assign()
           endif   
           return 0
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: GET y PASTE
Posted: Mon Mar 23, 2009 03:33 PM

Hola

Gracias por responder

Antonio, funciona hasta que uno selecciona un caracter en el medio y pegas este igual pasa de largo, este contro tiene AUTOHSCROLL

con la modificacion de daniel al parecer funciona bien, si que dejo las dos por si acaso

desde ya gracias..

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl

Continue the discussion