Ver Mensaje Individual
  #2  
Antiguo 08-12-2017
juniorSoft juniorSoft is offline
Miembro
 
Registrado: abr 2005
Posts: 178
Reputación: 19
juniorSoft Va por buen camino
Me respondo

Código:
...
type
  TForm1 = class(TForm)
    ...
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    procedure ActiveCtrlChange(Sender: TObject);
  ...
  end;

...
implementation

uses TypInfo;

const
  FOCUSEDCOLOR   = clMoneyGreen;
  UNFOCUSEDCOLOR = clWindow;

var
  PrevFocusedCtrl: TWinControl = nil;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Screen.OnActiveControlChange:= ActiveCtrlChange;
end;

procedure TForm1.ActiveCtrlChange(Sender: TObject);
begin
  if not Assigned(PrevFocusedCtrl) then
    PrevFocusedCtrl:= ActiveControl;

  if Assigned(GetPropInfo(PrevFocusedCtrl.ClassInfo, 'Color')) then
  begin
    // SetOrdProp(PrevFocusedCtrl, 'Color', UNFOCUSEDCOLOR);
    if PrevFocusedCtrl.StyleElements = [seBorder] then
           PrevFocusedCtrl.StyleElements:=[seFont, seClient, seBorder];
 end;
  if Assigned(GetPropInfo(ActiveControl.ClassInfo, 'Color')) then
  begin
    SetOrdProp(ActiveControl,'Color', FOCUSEDCOLOR);
    Activecontrol.StyleElements:=[seBorder];
    PrevFocusedCtrl:= ActiveControl;
     
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Screen.OnActiveControlChange:= nil;
end;
...
Responder Con Cita