Hola.
Coincido con lo que te han sugerido
dec y
luisgutierrezb.
Probá de este modo:
Código Delphi
[-]
procedure ComponentsColorDataSetStatus(myState:TDataSetState; AControl: TControl);
var
i:Integer;
myColor:TColor;
begin
myColor:= clWhite;
Case myState of
dsInactive: myColor := clGray;
dsBrowse : myColor := clWindow;
dsEdit : myColor := $00B7DBFF;
dsInsert : myColor := $00C5DEC9;
end;
if AControl is TForm then
with TForm(AControl) do
for i:= 0 to ComponentCount -1 do
begin
if Components[i] is TDBEdit then
TDBEdit(Components[i]).Color := myColor;
...
end;
if AControl is TFrame then
with TFrame(AControl) do
for i:= 0 to ComponentCount -1 do
begin
if Components[i] is TDBEdit then
TDBEdit(Components[i]).Color := myColor;
...
end;
end;
Llamadas:
Código Delphi
[-]
...
ComponentsColorDataSetStatus(DataSet.State, Form1);
ComponentsColorDataSetStatus(DataSet.State, Frame1);
No uso los componentes Tcx, por lo que tendrías que probar si el código funciona con ellos, aunque supongo que debería...
Saludos.