PDA

Ver la Versión Completa : TDBEdit


Un abrazo
19-05-2003, 12:03:38
Tengo un TDBEdit y quiero que cuando ponga sobre él un determinado texto se me activen otros edit que tengo con la propiedad enabled a false. Lo he hecho de la siguiente manera y no funciona

procedure TFEntradas.ERepresentanteExit(Sender: TObject);
begin
if ERepresentante.Text = 'S' then begin
ENifRepresentante.Enabled := true;
ENRepresentante.Enabled := true;
SBARepresentante.Enabled := true;
end else
Erepresentante.text := 'n';
ENifRepresentante.Enabled := false;
ENRepresentante.Enabled := false;
SBARepresentante.Enabled := false;

end;


Lo he probado con los eventos OnChange y OnExit y con ninguno funciona

Un Abraaaaaaaazo a Todos

Angel
19-05-2003, 12:17:21
si como dices es un TDBEdit entonces escribe el código en el evento onValidate del campo en cuestión, es decir, todo este código

if ERepresentante.Text = 'S' then begin
ENifRepresentante.Enabled := true;
ENRepresentante.Enabled := true;
SBARepresentante.Enabled := true;
end else
Erepresentante.text := 'n';
ENifRepresentante.Enabled := false;
ENRepresentante.Enabled := false;
SBARepresentante.Enabled := false;

ponlo en el Onvalidades de la tabla (supongo que le tabla se llamará Representantes, el evento onValidate lo tienes que crear para el campo ERepresentante)

Lepe
19-05-2003, 17:59:38
Una cochita tooonta.....
el else no tiene

begin

end


no será por esa tonteria no??? :D

[code]
if ERepresentante.Text = 'S' then begin
ENifRepresentante.Enabled := true;
ENRepresentante.Enabled := true;
SBARepresentante.Enabled := true;
end else begin
Erepresentante.text := 'n';
ENifRepresentante.Enabled := false;
ENRepresentante.Enabled := false;
SBARepresentante.Enabled := false;
end

Un abrazo
20-05-2003, 10:23:13
Pues si era por el Begin - end. gracias tio.


Un Abraazo.

Lepe
20-05-2003, 16:26:10
de nada hombre, es un placer, muchas veces pasa eso, estas tan obsecado con el programa que una cosa así te vuelve loco, y por más que lo miras lo ves bien :D, siempre es bueno que un tercer ojo eche una visual objetivamente.


Un saludo