Einzelnen Beitrag anzeigen

Benutzerbild von H4ndy
H4ndy

Registriert seit: 28. Jun 2003
Ort: Chemnitz
515 Beiträge
 
Delphi XE3 Professional
 
#8

Re: Ermitteln woher ein Control den Fokus erhalten hat

  Alt 30. Apr 2010, 14:25
Danke!

Ich hab es jetzt ueber den "Timer" im OnClose ueber eine Klassenvariable geloest, das erschien mir der Situation am angemessensten.
Das Formular mit der Statusbar ist schon ziemlich "Resourcenintensiv", von daher finde ich das globale "Erweitern" aller OnActivates, etc. als zu kritisch bzw. unnoetig, zumal da wirklich viele Komponenten drauf sind.

Noch mal vielen Danke fuer die qualitativen Beitraege!


Und weil Teilen freude macht (D2010, k.A. ab welcher Version das noch funktioniert):
Delphi-Quellcode:
  TPopup = class(TForm)
  public
    class var
      LastVisibleTime: Cardinal;
  private
    class constructor Create;
    // initializes the LastVisibleTime class var

    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  end;

class constructor TPopup.Create;
begin
  LastVisibleTime := 0;
end;

procedure TPopup.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  LastVisibleTime := GetTickCount;
end;

{Anderes Form}

procedure TIrgendeinForm.StatusBarClick(Sender: TObject);
begin
  if (TPopup.LastVisibleTime + 300) < GetTickCount then
  begin
    // Show only if there's a small time difference (300ms or more) to the
    // last OnClose of the Popup. This is to "close" the Popup with
    // clicking on the Statusbar again.
    TPopup.Execute(bla bla bla);
  end;
end;
Manuel
  Mit Zitat antworten Zitat