Sign in Join
FPDoc Onlineexperiment

TFileNameEdit.Text property

Member of TFileNameEditpublishedIn unit EditBtn

String with the text or caption for the control.

Declaration

pascal
property Text:;

Description

This is the character string, shown in controls with visible text content (TEdit...).

BEWARE: In other controls it can be the Name or Caption of the control, quite tricky to use.

The Delphi VCL implementation stores Text mostly in the widgets, using the virtual Get/SetTextBuf methods to exchange text between widgets and VCL. This means a lot of text copies and message handling in WM_GETTEXT and WM_SETTEXT.

The LCL instead (typically) stores Text in a field of the control, and transfers it from/to the widgets only when required.

To maintain VCL compatibility, the virtual RealGet/SetText methods have been introduced, which read or write the Caption string directly.

The default Get/SetTextBuf implementation calls the RealGet/SetText methods, resulting in a string-to-PCHAR and another PCHAR-to-string conversion. But as long as Get/SetTextBuf is not overridden, Get/SetText can (and does) safely call RealGet/SetText immediately, to avoid the mentioned conversions.

To keep things optimal, LCL components should always override RealGet/SetText; Get/SetTextBuf is only kept for compatibility.

This description is the one of Controls.TControl.Text.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.