[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'Clipbrd' (#lcl)

# TClipboard.GetComponent

Gets a TComponent instance with the specified owner and parent from the clipboard.

## Declaration

Source position: clipbrd.pp line 200

`public function TClipboard.GetComponent(`
`Owner: TComponent;`
`Parent: TComponent`
`):TComponent; procedure TClipboard.GetComponent(`
`var RootComponent: TComponent;`
`OnFindComponentClass: TFindComponentClassEvent;`
`Owner: TComponent = Nil;`
`Parent: TComponent = Nil`
`);`

## Arguments

`Owner` |  | TComponent instance which owns the component on the clipboard.
`Parent` |  | TComponent instance which is the parent for the component on the clipboard.

## Function result

TComponent instance created from the clipboard data, or Nil when not found.

## Arguments

`Owner` |  | TComponent instance which owns the component on the clipboard.
`Parent` |  | TComponent instance which is the parent for the component on the clipboard.

## Description

GetComponent is an overloaded method in TClipboard used to read a TComponent instance that was previously stored to the clipboard.

GetComponent allocates a temporary TMemoryStream which is used to read the content stored to a pcfComponent clipboard format (when found). The OnFindComponentClass argument is called to retrieve the class type needed to re-create the TComponent instance. The ReadComponentFromBinaryStream routine (in LResources) is called to create the component in the return value using the arguments to the method.

The return value is Nil if there is no component on the clipboard with the Owner and Parent specified in the arguments to the method.

## See also

ReadComponentFromBinaryStream |  |