System.Classes.TReader.ReadRootComponent

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ReadRootComponent(const Root: TComponent): TComponent;

C++

TComponent* __fastcall ReadRootComponent(TComponent* const Root);

Properties

Type Visibility Source Unit Parent
function public
System.Classes.pas
System.Classes.hpp
System.Classes TReader

Description

Reads a component and all its owned components from the reader object's stream.

Do not call ReadRootComponent directly. It is used internally by the component streaming system. When the reader object is created by its stream in the stream's ReadComponent method, it immediately calls the ReadRootComponent method, which initiates the streaming sequence of restoring an object.

ReadRootComponent first calls the ReadSignature method to ensure that it is reading a proper component. ReadRootComponent also handles initializations and fixup references. For example, the component passed in Root becomes the value of the Root property for the reader object.

ReadRootComponent calls the component's ReadState method, which calls back to the reader's ReadData method. The ReadState method of TComponent is virtual, which allows component classes to override ReadState to prepare themselves for being loaded with the new data from the stream.

See Also