AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi OnExit erigniss wird nicht ausgelöst beim deaktiven Fenster
Thema durchsuchen
Ansicht
Themen-Optionen

OnExit erigniss wird nicht ausgelöst beim deaktiven Fenster

Ein Thema von Karstadt · begonnen am 6. Jan 2006 · letzter Beitrag vom 6. Jan 2006
 
Benutzerbild von dataspider
dataspider

Registriert seit: 9. Nov 2003
Ort: 04539 Groitzsch
1.361 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: OnExit erigniss wird nicht ausgelöst beim deaktiven Fens

  Alt 6. Jan 2006, 10:03
Hi,

ich habe mal ein Beispiel für eine Lösung mit einer extra Unit.
Einfach ins Projekt aufnehmen und ausprobieren.
Muss sicher für eigene Ansprüche noch angepasst werden.

Delphi-Quellcode:
unit EditColorHandler;

interface
Uses Forms, Classes, Controls, Graphics, StdCtrls;


Const
  _ActiveColor = $009BF5FD;
  _DefaultColor = clWhite;

type
  TEditColorHandler = class(TObject)
  private
    FActiveControl: TWinControl;
    FActive: Boolean;
    procedure SetActive(const Value: Boolean);
  public
    procedure doActiveControlChange(Sender: TObject);
    property Active: Boolean read FActive write SetActive;
  end;

Var
  AppEditColorHandler: TEditColorHandler;


implementation


procedure TEditColorHandler.doActiveControlChange(Sender: TObject);
begin

  if Assigned(FActiveControl) and FActiveControl.HandleAllocated and
    (FActiveControl is TEdit) then
    TEdit(FActiveControl).Color := _DefaultColor;

  FActiveControl := Screen.ActiveControl;

  if FActiveControl is TEdit then
    TEdit(FActiveControl).Color := _ActiveColor;

end;

procedure TEditColorHandler.SetActive(const Value: Boolean);
begin
  if FActive <> Value then
  begin
    FActive := Value;
    if FActive then
      Screen.OnActiveControlChange := doActiveControlChange
    else
      Screen.OnActiveControlChange := nil;
  end;
end;

initialization
  AppEditColorHandler := TEditColorHandler.Create;
  AppEditColorHandler.Active := True;

finalization
  AppEditColorHandler.Free;
end.
Cu, Frank
Frank Reim
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:40 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz