Einzelnen Beitrag anzeigen

Benutzerbild von baumina
baumina

Registriert seit: 5. Mai 2008
Ort: Oberschwaben
1.275 Beiträge
 
Delphi 11 Alexandria
 
#1

Was hat MainFormOnTaskbar mit csFreeNotification zu tun?

  Alt 16. Apr 2014, 06:58
Ich habe ein Projekt in Delphi XE. Auf einem Formular liegt eine Eigenkomponente. Die Eigenkomponente sieht so aus:

Delphi-Quellcode:
  TfmAutoSearch = class(TForm)
  ....
  private
   lGrid : TMarkedDBGrid;
   OldKeyPress : TKeyPressEvent;
   procedure SetGrid(aGrid : TMarkedDBGrid);
    ....
  public
   property OldKeyPressed : TKeyPressEvent read OldKeyPress;
  published
   property Grid : TDBGrid read lGrid write SetGrid;
   ...
  end;

...
procedure TfmAutoSearch.SetGrid(aGrid : TMarkedDBGrid);
begin
  if ((lGrid <> nil) and not (csDesigning in ComponentState)) then
  begin
    lGrid.OnKeyPress := OldKeyPress;
  end;
  lGrid := aGrid;
  if ((lGrid <> nil) and not (csDesigning in ComponentState) and not (csFreeNotification in ComponentState)) then
  begin
    OldKeyPress := lGrid.OnKeyPress;
    lGrid.OnKeyPress := grdKeyPress;
  end;
end;
....
Die Grid wird zur Entwurfszeit zugeordnet. Beim Ausführen des Projekts habe ich 2 verschiedene Verhaltensweisen:

1. Ist MainFormOnTaskbar = False, dann ist ComponentState im SetGrid [].
2. Ist MainFormOnTaskbar = True, dann ist ComponentState im SetGrid [csFreeNotification].

MainFormOnTaskbar wird dabei jeweils direkt im Projektquelltext nach dem Application.Initialize gesetzt.

Hat da jemand eine Erklärung warum das so ist?
Hinter dir gehts abwärts und vor dir steil bergauf ! (Wolfgang Ambros)
  Mit Zitat antworten Zitat