stringdelphidesignerobject-inspector

How to use sLineBreak from the object inspector?


Currently, I'm setting a string which contains sLineBreak constant as value for the Caption property of a TLabel control.

MyLabel.Caption := 'A' + sLineBreak + 'B';

sLineBreak is defined in System.pas as follows (Delphi 2007):

const
      sLineBreak = {$IFDEF LINUX} #10 {$ENDIF} {$IFDEF MSWINDOWS} #13#10 {$ENDIF};

Is there a way to do the same thing by using the object inspector? (At design time).

Update: Probably in future I will move this project to a newer IDE and will develop on different platforms, but at the moment there's no particular reason why I'm using sLineBreak instead of #13#10. I'm sorry for misunderstanding.


Solution

  • You cannot use the sLineBreak constant at design-time. However, you can either:

    1. Edit the DFM directly (right-click the Form Designer and choose View as Text) to insert CR/LF characters into the encoded Caption text, eg:

      Using a bare-LF line break

      object MyLabel: TLabel
        Caption = 'A'#10'B'
      end
      

      Using a CRLF line break

      object MyLabel: TLabel
        Caption = 'A'#13#10'B'
      end
      
    2. Install a third party design-time property editor (or write your own) that allows multi-line editing of String property values. For example, "Extended String Property Editor".