Autor Beitrag
DOCa Cola
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: So 09.01.05 15:55 
gibt es ein event das nach OnShow ausgeführt wird? soetwas wie als würde man sofort einen button drücken sobald das fenster komplett angezeigt wurde?
MAlsleben
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 303

W2k,WinXP
D3 - DXE3 Enterprise
BeitragVerfasst: Mo 10.01.05 09:04 
Hi,

Auszug aus der Delphi - Hilfe.

Wenn ein Formular erzeugt wird und seine Eigenschaft Visible auf true gesetzt ist, werden die folgenden Ereignisse in der angegebenen Reihenfolge ausgelöst:

1. OnCreate
2. OnShow
3. OnActivate
4. OnPaint

Vielleicht hilft Dir das schon mal weiter.

Gruß Micha.

_________________
Viele Wege führen nach Rom.
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Mo 10.01.05 09:23 
gut, aber ist es nicht auch so das OnActivate immer ausgeführt wird wenn das fenster in den focus kommt und OnPaint immer dann wenn das fenster von Windows neu gezeichnet wird? Es ist einfach so das es dann zu problemen kommen kann das die funktion mehr als einmal ausgeführt wird...ich finde es recht seltsam das es nicht einfach soetwas gibt das dann abläuft wenn diese ganzen vorhandenen OnWasweisich ausgeführt sind
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 10.01.05 09:37 
Hi,

Vielleicht suchst du so was:

www.swissdelphicente...showcode.php?id=1276
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 10.01.05 10:14 
DOCa Cola hat folgendes geschrieben:
gut, aber ist es nicht auch so das OnActivate immer ausgeführt wird wenn das fenster in den focus kommt und OnPaint immer dann wenn das fenster von Windows neu gezeichnet wird?

Jupp.
Zitat:

Es ist einfach so das es dann zu problemen kommen kann das die funktion mehr als einmal ausgeführt wird...

Und was hindert dich daran, dir zu merken, dass die Funktion schon einmal ausgeführt wurde und wenn das Ereigniss beim nächsten Mal eintritt, die Funktion dann nicht mehr auszuführen?
IngoD7
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 629


D7
BeitragVerfasst: Mo 10.01.05 10:21 
Früher oder später steht jeder mal vor dem Problem, dass nach erstmaliger Anzeige eines Forms einmal(!) etwas automatisch ausgeführt oder ausgelöst werden soll.

Ich löse es im OnActivate:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormActivate(Sender: TObject);
begin
if Programmstart then  // <-- Flag, muss vorher (z.B. in OnCreate) 
                       // auf true gesetzt werden.
   begin
   ...    // Das, was nur einmal direkt beim 
   ...    // Programmstart ausgeführt werden soll.
   Programmstart := false;
   end;
...    // Das, was bei jedem Activate ausgeführt werden soll.
end;
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 10.01.05 10:52 
@Ingo:
Das wär was für die FAQs. Dies Problem ist in verschiedener Form schon häufiger aufgetaucht.
Ich löse das übrigens auch nach diesem Prinzip. Bei mir heist die Variable nur FirstTime.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 10.01.05 10:57 
Häufig wird das ganze aber auch über einen User-Message-Handler gelöst, in dem man an das Formular eine benutzerdefinierte Meldung schickt, die dann vom Formular verarbeitet wird. Source-Abschnitt kann ich auf Wunsch noch ergänzen.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 10.01.05 14:14 
ich ahb auch schonmal gesehen, dass leute dafür einen timer hernuehmen, den sie auf 10 ms einstellen und ihn sich selber dann im OnTimer deaktivieren lassen.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 10.01.05 14:59 
Die Lösung mit dem Timer halte ich für unbrauchbar. Wenn der Rechner beim Programmstart stark beschäftigt ist, genügen die 10 ms vielleicht nicht. Wer weiß schon, wo man da die zeitliche Grenze setzen soll.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 10.01.05 15:25 
BenBE hat folgendes geschrieben:
Häufig wird das ganze aber auch über einen User-Message-Handler gelöst, in dem man an das Formular eine benutzerdefinierte Meldung schickt, die dann vom Formular verarbeitet wird. Source-Abschnitt kann ich auf Wunsch noch ergänzen.


Habe bereits einen Link gepostet, wo das demonstriert wird. (siehe oben)
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Mo 10.01.05 16:26 
na, auf jedenfall gibt es ein gutes workaround, trotzdem einfach seltsam das nicht von vornherein so eine funktion existiert

gruß DOCa Cola