TToolButton.RealSetText procedure
Declaration
procedure RealSetText(const AValue: TCaption); overrideDescription
Not described here; this is what TControl.RealSetText says of it:
Sets the value for the Caption property.
RealSetText is a method used to apply the TCaption value in AValue to the
text or caption for the control. RealSetText is called by the private
SetText method, when SetTextBuf has not been overridden.
Notes on TControl.Caption, TControl.Text, et. al.
The Delphi VCL implementation relies on the virtual GetTextBuf and SetTextBuf methods to exchange text for controls.. This requires a lot of (unnecessary) copies to move values between Text and Caption.
The LCL uses strings to exchange text values because it is more efficient. To maintain VCL compatibility, the virtual RealGetText and RealSetText methods were introduced. These functions use the LCLInterface. The default GetTextBuf and SetTextBuf implementations calls the RealGetText and RealSetText methods as needed. As long as the GetTextBuf and/or SetTextBuf aren't overridden, GetText and SetText call RealGetText and RealSetText to avoid copying PChar values.
To keep things optimal, LCL implementations should always override RealGetText and RealSetText. GetTextBuf and SetTextBuf are only kept for compatibility with Delphi code.
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
