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

# TControl.GetTextBuf

Gets text associated with the control from a buffer

## Declaration

Source position: controls.pp line 1334

`public function TControl.GetTextBuf(`
`Buffer: PChar;`
`BufSize: Integer`
`):Integer; virtual;`

## Arguments

`Buffer` |  | Pointer to the buffer containing the string
`BufSize` |  | Length of the buffer

## Function result

Pointer to the buffer containing the text

## Description

    * The VCL implementation relies on the virtual Get/SetTextBuf to
     * exchange text between widgets and VCL. This means a lot of
     * (unnecesary) text copies.
     * The LCL uses strings for exchanging text (more efficient).
     * To maintain VCL compatibility, the virtual RealGet/SetText is
     * introduced. These functions interface with the LCLInterface. The
     * default Get/SetTextbuf implementation calls the RealGet/SetText.
     * As long as the Get/SetTextBuf isn't overridden Get/SetText
     * calls RealGet/SetText to avoid PChar copying.
     * To keep things optimal, LCL implementations should always
     * override RealGet/SetText. Get/SetTextBuf is only kept for
     * compatibility.

## See also

RealGetText |  | Function to get a text-string associated with the control
GetText |  | Function to get text-string associated with control

The latest version of this document can be found at lazarus-ccr.sourceforge.net .