Ver Mensaje Individual
  #10  
Antiguo 11-03-2013
bigguntm bigguntm is offline
Miembro
NULL
 
Registrado: nov 2012
Posts: 16
Reputación: 0
bigguntm Va por buen camino
Hola a todos, gracias a todos por responder, el codigo quedo asi..

Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
      with Edit2 do
  begin
    Text     := '';
    EditMask := 'MEP-00000-000;0; ';
    CharCase := ecUpperCase;

Código Delphi [-]
procedure TForm1.Edit2Change(Sender: TObject);
begin
   if Length(Edit2.Text) = 8 then
      btnCalculate.Enabled := True else
      btnCalculate.Enabled := false;

Código Delphi [-]
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  with Sender as TMaskEdit do
    if SelStart < 13 then
      btnCalculate.Enabled:= (SelStart = 12) and (key <> #8);

Todo anda perfecto, si MaskEdit no tiene los 8 numeros ingresados el btnCalculate esta en false, y si ingresamos los 8 digitos se habilita, esto lo hace Edit2Change, entonces si MEP-56456-456, y borramos el (5), MEP-56456-4_6, el btnCalculate queda habilitado, por eso se usa el Edit2KeyPress, quien hace vulnerable ese efecto, hasta ahi todo funciona correctamente, pero coloco MEP-56456-456, el btn queda habilitado, presiono el btnCalculate, luego le borro el ultimo numero MEP-56456-45_, y cierro el form en btnExit(KillTask), me da una funcion no deseada(error)! lo solucione con

Código Delphi [-]
procedure TForm1.btnExitMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
Edit2.Text     := ' ';
end;

Gracias y Saludos
Responder Con Cita