Difference between revisions of "Event order/de"

From Lazarus wiki
Jump to navigationJump to search
(Translation)
Line 9: Line 9:
 
Das [[Lazarus_Tutorial#Event_Actions|Lazarus Tutorial]] hat ein paar Informationen darüber, welches Ereignis was macht.
 
Das [[Lazarus_Tutorial#Event_Actions|Lazarus Tutorial]] hat ein paar Informationen darüber, welches Ereignis was macht.
  
== [[TForm|Forms]] ==
+
== [[TForm/de|Formulare]] ==
Typical event order for [[TForm|forms]] is:
+
Die Typische Ereignisreiheinfolge (zu sehen im Objektinspektor im Reiter Ereignisse) für [[TForm/de|Formulare]] ist:
 
  OnCreate => OnShow => OnActivate => OnPaint => OnResize => OnPaint => ...  
 
  OnCreate => OnShow => OnActivate => OnPaint => OnResize => OnPaint => ...  
 
  OnCloseQuery => OnClose => OnDeactivate => OnHide => OnDestroy
 
  OnCloseQuery => OnClose => OnDeactivate => OnHide => OnDestroy
  
 
=== Form.OnCreate ===
 
=== Form.OnCreate ===
This is the equivalent to the class constructor in forms. Use this to initialize form-level variables etc. The form is not yet shown at this time.
+
Dies entspricht dem Konstruktor der Klasse in Formularen. Nutzen Sie dieses Ereignis, um Variablen auf Formularebene zu initialisieren. Das Formular ist im Moment noch nicht gezeigt.
  
 
=== Form.OnShow ===
 
=== Form.OnShow ===
When the form is shown (e.g. when loading the form or setting its <code>.Visible</code> property to true), this event is fired - just before the form is visible. This allows you to modify the visual appearance of controls (e.g. disable certain controls) without flickering.
+
Wenn das Formular angezeigt wird (z.B. beim Laden des Formulars oder Stellen der <code>.Visible</code>-Eigenschaft auf ''True''), wird dieses Ereignis ausgelöst - kurz bevor das Formular sichtbar ist. Dadurch können Sie die visuelle Darstellung von Steuerelementen ändern (z.B. bestimmte Steuerelemente deaktivieren), ohne Flimmern.
  
 
=== Form.OnActivate ===
 
=== Form.OnActivate ===
Fired once after Form.OnCreate.
+
Einmal nach Form.OnCreate ausgelöst.
  
 
=== Form.OnDestroy ===
 
=== Form.OnDestroy ===
The equivalent to a class destructor in forms. Use this to clean up/free variables.
+
Entspricht ein Klassendestruktor in Formen. Verwenden Sie diese, um aufzuräumen (Variablen wieder frei zu geben).
  
 
== General controls ==
 
== General controls ==

Revision as of 22:23, 15 May 2014

Deutsch (de) English (en) suomi (fi)

Übersicht

Lazarus stellt verschiedene Ereignisse (engl. Events) zur Verfügung um Dinge die zur Laufzeit Ihrer Anwendung auftreten können, zu handhaben (in denen Sie Ihre eigenen Operationen einfügen können). Ein solches Ereignis kann ein Buttonklick eines Nutzers, eine Eingabe in ein Textfeld, das Drücken einer Taste und noch vieles andere sein.

Es gibt daher eine Menge von möglichen Ereignissen um vielen verschiedenen Szenarien gerecht zu werden. Jemand, der Lazarus oder Delphi noch nicht kennt, kann auch schnell ein falsches Ereignis wählen.

Lazarus Dokumentation

Das Lazarus Tutorial hat ein paar Informationen darüber, welches Ereignis was macht.

Formulare

Die Typische Ereignisreiheinfolge (zu sehen im Objektinspektor im Reiter Ereignisse) für Formulare ist:

OnCreate => OnShow => OnActivate => OnPaint => OnResize => OnPaint => ... 
OnCloseQuery => OnClose => OnDeactivate => OnHide => OnDestroy

Form.OnCreate

Dies entspricht dem Konstruktor der Klasse in Formularen. Nutzen Sie dieses Ereignis, um Variablen auf Formularebene zu initialisieren. Das Formular ist im Moment noch nicht gezeigt.

Form.OnShow

Wenn das Formular angezeigt wird (z.B. beim Laden des Formulars oder Stellen der .Visible-Eigenschaft auf True), wird dieses Ereignis ausgelöst - kurz bevor das Formular sichtbar ist. Dadurch können Sie die visuelle Darstellung von Steuerelementen ändern (z.B. bestimmte Steuerelemente deaktivieren), ohne Flimmern.

Form.OnActivate

Einmal nach Form.OnCreate ausgelöst.

Form.OnDestroy

Entspricht ein Klassendestruktor in Formen. Verwenden Sie diese, um aufzuräumen (Variablen wieder frei zu geben).

General controls

These events apply to various controls. Please use the Object Inspector to check if it is available for the control you're currently using.

OnEditingDone

The OnEditingDone event for controls can act like the Validate event in other programming languages: it indicates the user is done changing the control and intends to keep that value. The program can now check the control content for correctness, show error messages, update database fields, etc.

Light bulb  Hinweis: As soon as you click outside the control (even on a control that cannot receive focus) OnEditingDone is triggered.

(See TControl.MouseDown procedure, introduced in r11778).

Applicable Delphi information

Because the implementation of events in Lazarus and Delphi is similar, a lot of Delphi-related documentation is applicable to Lazarus with minor modifications.

Delphi documentation is often handy. You can search for the actual control you want to know more about to get a list of its events.

If you want to know about the order in which events fire on a form, this article from about.com can be useful.

See also