GET y PASTE ( SOLUCIONADO )

GET y PASTE ( SOLUCIONADO )

Postby Patricio Avalos Aguirre » Fri Mar 20, 2009 3: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
Last edited by Patricio Avalos Aguirre on Mon Mar 23, 2009 3:33 pm, edited 1 time in total.
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: GET y PASTE

Postby Antonio Linares » 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: Select all  Expand view

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
User avatar
Antonio Linares
Site Admin
 
Posts: 41937
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: GET y PASTE

Postby Daniel Garcia-Gil » Sun Mar 22, 2009 10:36 pm

Patricio,

Prueba cambiando en el metodo HandleEvent este CASE

Code: Select all  Expand view

      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

 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: GET y PASTE

Postby Patricio Avalos Aguirre » Mon Mar 23, 2009 3: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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests