Gracias amigos por contribuir, creo haber solucionado, de esta manera. Aquí la función
función
Código Delphi
[-]procedure TForm1.OnOfReadOnly(const Enabled: Boolean; Ctrls: array of TControl);
var
i: Integer;
begin
for i:= Low(Ctrls) to High(Ctrls) do
begin
if TWinControl(Ctrls[i]) is TEdit then
begin
if Enabled
then TEdit(Ctrls[i]).Color := $00FEEAD3
else TEdit(Ctrls[i]).Color := clWhite;
TEdit(Ctrls[i]).ReadOnly := Enabled;
end
else if TWinControl(Ctrls[i]) is TcxCurrencyEdit then
begin
if Enabled
then TcxCurrencyEdit(Ctrls[i]).Style.Color := $00FEEAD3
else TcxCurrencyEdit(Ctrls[i]).Style.Color := clWhite;
TcxCurrencyEdit(Ctrls[i]).Properties.ReadOnly := Enabled;
end
else if TWinControl(Ctrls[i]) is TsDateEdit then
begin
if Enabled
then TsDateEdit(Ctrls[i]).Color := $00FEEAD3
else TsDateEdit(Ctrls[i]).Color := clWhite;
TsDateEdit(Ctrls[i]).ReadOnly := Enabled;
end;
end;
end;
Para usarlo.
Código Delphi
[-]procedure TFProductos.Button1Click(Sender: TObject);
begin
OnOfReadOnly(True, [Edit1, cxCurrencyEdit1, TsDateEdit1]);
end;
Para volver al estado anterior de los componentes simplemente el True por False.