Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.168 Beiträge
 
Delphi 12 Athens
 
#6

AW: TTabcontrol - OnExit funktioniert nicht wie erwartet

  Alt 30. Okt 2016, 13:22
Delphi-Quellcode:
type
  TExitFormHelper = class helper for TForm
  private type
    TProtectedControl = class(TWinControl);
  public
    procedure CheckOnExit(WithOnEnter: Boolean=False);
  end;

procedure TExitFormHelper.CheckOnExit(WithOnEnter: Boolean);
begin
  if not Assigned(Self.ActiveControl) then
    Exit;
  TProtectedControl(ActiveControl).DoExit;
  if WithOnEnter then
    TProtectedControl(ActiveControl).DoEnter;
end;
Und dann halt im OnCloseQuery/OnClose/OnDestroy und eben in den ClickEvents von Menüs/SpeedButtons das CheckOnExit aufrufen.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat