Ver Mensaje Individual
  #3  
Antiguo 09-09-2008
dgallardov dgallardov is offline
Registrado
 
Registrado: ago 2008
Posts: 4
Reputación: 0
dgallardov Va por buen camino
Cita:
Empezado por Caro Ver Mensaje
Hola dgallardov, puedes utilizar las propiedades SelStart y SeLength del Edit.

Código Delphi [-]
 Edit1.SetFocus;
 Edit1.SelLength := 0;
 Edit1.SelStart := Length(Edit1.Text);

Saluditos
se agradece el codigo, eso me salvo, lo que estaba haciendo era lo siguiete
estaba validando un dni o rut en chile, al escribir los caracteres en el edit tenia que colocar automaticamente el digito verificador pero tenia que hacerlo dinamicamente ya que el rut puede ser menor a 8 caracteres, use este codigo por algun motivo al escribir el segundo caracter se posicionaba al comienzo del edit.
Código:
procedure TForm1.Edit1Change(Sender: TObject);
var
 texto,rut,letra,ultimo:string;
 largo:integer;
 i:integer;

begin
   texto:=edit1.text;
   largo:=length(texto);
 i:=0;
 for i:=1 to largo do
  begin
   if not(copy(texto,i,1) = '-') then
      begin
       rut:=rut+copy(texto,i,1);
      end;

      if i=(largo-1) then
       begin
       rut:=rut+'-';
       end;
  end;


 edit1.Text:=rut;
 Edit1.SetFocus;
 Edit1.SelLength := 0;
 Edit1.SelStart := Length(Edit1.Text);
end;
muy agradecido por la respuesta, he solucionado lo que necesitaba.

hasta pronto
Responder Con Cita