Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #9  
Antiguo 04-01-2008
Avatar de elcolo83
elcolo83 elcolo83 is offline
Miembro
 
Registrado: feb 2007
Ubicación: Argentina
Posts: 65
Poder: 20
elcolo83 Va por buen camino
añadiendo al codigo de jjfgg...
Código Delphi [-]
uses
  StrUtils;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
  S: string;
  ss: Integer;
begin
  if (Edit1.SelStart = 0)   // primera posición
    or (Edit1.Text[ Edit1.SelStart ] in WordDelimiters) then // posición anterior es un separador de palabras
    Key := UpCase(Key);

  if ((Length(Edit1.Text)>Edit1.SelStart) // revisa si se inserta
      and (Key in WordDelimiters)) then // un delimitador de palabras
  begin
    S := Edit1.Text; // copia el contenido del edit para modificarlo
    S[ Edit1.SelStart + 1] := UpCase(S[ Edit1.SelStart + 1 ]); // convierte el siguiente caracter en mayuscula
    ss := Edit1.SelStart; // Guarda la posición del cursor
    Edit1.Text := S;  // Cambia el texto
    Edit1.SelStart := ss // Coloca el cursor de regreso en su posición
                         // esto es porque al sustituir la cadena
                         // el cursor se mueve a la primera posición
  end
end;

POdriamos agregarle un if en caso que un caracter sea borrado corrija el texto, entonces agregamos este codigo en el evento OnKeyUp

Código Delphi [-]

procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
var ss: integer;
    k: char;
begin
if ((key = 8) or (key = 46)) then    //Si preciona la tecla back o sup
    begin
      edit1.SelLength:= 1;
      ss := Edit1.SelStart;
      caption:= edit1.SelText;
      edit1.SelText:= Lowercase(edit1.SelText);
      edit1.SelLength:= 1;
      edit1.SelStart:= ss;

      k:= char(key);
      if (Edit1.Text[ Edit1.SelStart ] = ' ') then
        begin
          k:= #0;
          Edit1KeyPress(Sender, K);
        end;
    end;
end;
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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
pulsar una tecla ercrizeporta Varios 1 28-09-2006 17:31:52
Saber si una tecla esta pulsada? fefe13 Varios 9 02-02-2006 18:06:56
Saber cuando se pulsa la tecla Enter D@byt Varios 2 25-05-2005 17:21:52
Tecla PetSis y tecla Inter Tomás Windows 0 24-04-2004 14:20:19
TECLA F1 o F10 andrestsas Varios 2 03-08-2003 17:44:11


La franja horaria es GMT +2. Ahora son las 07:05:43.


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