Ver Mensaje Individual
  #12  
Antiguo 21-02-2007
Avatar de nuk3zito
nuk3zito nuk3zito is offline
Miembro
 
Registrado: ago 2003
Ubicación: "Z" Land
Posts: 244
Reputación: 21
nuk3zito Va por buen camino
Para el que dice que el clWindow no existe, basta con agregar en el uses la unit "Graphics"

Y con ese código que pones se puede hacer mucho más... por ejemplo:

En la declaración del objeto de la forma...
Código Delphi [-]
   procedure EnterControl(Sender: TObject);
   procedure ExitControl(Sender: TObject);

Código Delphi [-]
procedure TForm1.EnterControl(Sender: TObject);
begin
  if Sender is TWinControl then
     TWinControl(Sender).Color := clYellow;
end;

Código Delphi [-]
procedure TForm1.ExitControl(Sender: TObject);
begin
  if Sender is TWinControl then
     TWinControl(Sender).Color := clWindow;
end;


y en el OnCreate de la Forma...
Código Delphi [-]
   for i:= 0 to ComponentCount - 1 do
   begin
      // Pongo de Clase por clase porque ninguna clase
      // genérica puede asegurarnos que tengamos los 
      // métodos OnEnter u OnExit
      if (Components[i] is TEdit) then
       begin
         TEdit(Components[i]).OnEnter:= EnterControl;
         TEdit(Components[i]).OnExit:= ExitControl;
       end
      else if (Components[i] is TDBEdit) then
       begin
         TDBEdit(Components[i]).OnEnter:= EnterControl;
         TDBEdit(Components[i]).OnExit:= ExitControl;
       end;
   end;


Sorry... es que ando aburrido y necesitaba escribir...

Saludos


Responder Con Cita