Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 06-04-2005
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.449
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Si colocas un form con cuatro botones (SpeedButton por el tema del foco), uno para la tecla (debería ser igual para todas las teclas, pero cambiando el caracter), uno para borrar, uno para la flecha izquierda y otro para la derecha, con algo así debería bastar:

Código Delphi [-]
 procedure TForm1.BotonTeclaClick(Sender: TObject);
 var
   i:Integer;
   ch:Char;
   pos:Integer;
   Str1, Str2:String;
 begin
   // Generar la tecla
   Randomize;
   i := Trunc(Random(25)) + 65;
   ch := Char(i);
   i := Edit1.SelStart;
   // Calcular la posion y los strings parciales
   pos := Edit1.SelStart;
   Str1 := Copy(Edit1.Text, 1, pos);
   Str2 := Copy(Edit1.Text, pos + 1, Length(Edit1.Text));
   // Añadir la nueva
   Edit1.Text := Str1 + ch + Str2;
   Edit1.SelStart := i + 1;
 end;
 
 procedure TForm1.BotonBorrarClick(Sender: TObject);
 var
   pos:Integer;
   Str1, Str2:String;
   i:Integer;
 begin
   // posicion actual del cursor
   i := Edit1.SelStart;
   // Calcular la posion y los strings parciales
   pos := Edit1.SelStart;
   Str1 := Copy(Edit1.Text, 1, pos - 1);
   Str2 := Copy(Edit1.Text, pos + 1, Length(Edit1.Text));
   // Añadir la nueva
   Edit1.Text := Str1 + Str2;
   Edit1.SelStart := i - 1;
 end;
 
 procedure TForm1.BotonFlechaIzquierdaClick(Sender: TObject);
 begin
   // Mover el cursor
   Edit1.SelStart := Edit1.SelStart - 1;
 end;
 
 procedure TForm1.BotonFlechaDerechaClick(Sender: TObject);
 begin
   // Mover el cursor
   Edit1.SelStart := Edit1.SelStart + 1;
 end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 15:26:57.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi