After a component reads all its property values from its stored description, it calls a virtual method named Loaded, which performs any required initializations. The call to Loaded occurs before the form and its controls are shown, so you do not need to worry about initialization causing flicker on the screen.
To initialize a component after it loads its property values, override the Loaded method.
procedure TDatabase.Loaded; begin inherited Loaded; { call the inherited method first} try if FStreamedConnected then Open { reestablish connections } else CheckSessionName(False); except if csDesigning in ComponentState then { at design time... } Application.HandleException(Self) { let Delphi handle the exception } else raise; { otherwise, reraise } end; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|