Class TCastleLabel
Unit
CastleControls
Declaration
type TCastleLabel = class(TCastleUserInterfaceFont)
Description
Label with possibly multiline text, in an optional box.
Hierarchy
Overview
Fields
Methods
Properties
Description
Fields
 |
nested const DefaultLineSpacing = 2; |
|
Methods
 |
procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override; |
|
 |
function GetInternalText: String; override; |
|
 |
procedure SetInternalText(const Value: String); override; |
|
 |
procedure UIScaleChanged; override; |
|
 |
constructor Create(AOwner: TComponent); override; |
|
 |
destructor Destroy; override; |
|
 |
procedure Render; override; |
|
 |
procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override; |
|
 |
procedure FontChanged; override; |
|
 |
function DisplayChars: Cardinal; |
|
Properties
 |
property Color: TCastleColor read FColor write FColor; |
Text color. By default it's opaque black.
|
 |
property FrameColor: TCastleColor read FFrameColor write FFrameColor; |
Color tint of the background image, see Frame. By default white.
|
 |
property AutoSize: boolean read FAutoSize write SetAutoSize default true; |
Should we automatically adjust size to the text size. The size of the label determines where does it display the Frame, where does it catch events, to what width is it aligned (see Alignment) and so on.
When this is True (the default) then Width, Height, FullSize values are ignored.
|
 |
property Text: TStrings read FText write SetText; |
Caption displayed on the label, each line as a String. Setting this property merely copies the contents using TStrings.Assign.
|
 |
property Caption: String read GetCaption write SetCaption stored false; |
Caption displayed on the label. This is just a shortcut to get/set Text as a single String.
Use LineEnding or NL constant when setting this to indicate a newline. The two examples below are equivalent:
Label1.Text.Clear;
Label1.Text.Add('First line');
Label1.Text.Add('Second line');
Label1.Caption := 'First line' + LineEnding + 'Second line';
|
 |
property PaddingHorizontal: Single
read FPaddingHorizontal write SetPaddingHorizontal default 0; |
Inside the label rectangle, padding between rect borders and text. Total horizontal padding is the sum PaddingHorizontal + Padding , total vertical padding is the sum PaddingVertical + Padding .
|
 |
property PaddingVertical: Single
read FPaddingVertical write SetPaddingVertical default 0; |
|
 |
property Padding: Single
read FPadding write SetPadding default 0; |
|
 |
property LineSpacing: Single read FLineSpacing write FLineSpacing default DefaultLineSpacing; |
Extra spacing between lines. May be negative to squeeze lines tighter together.
|
 |
property Html: boolean read FHtml write SetHtml default false; |
Does the text use HTML markup. This allows to easily change colors or use bold, italic text.
See the example examples/fonts/html_text.lpr and examples/fonts/html_text_demo.html for a demo of what HTML tags can do. See TCastleAbstractFont.PrintStrings documentation for a list of support HTML markup.
Note that to see the bold/italic font variants in the HTML markup, you need to set the font to be TCastleFontFamily with bold/italic variants. See the example mentioned above, examples/fonts/html_text.lpr, for a code how to do it.
|
 |
property Tags: boolean read FHtml write SetHtml stored false default false; deprecated 'use Html instead'; |
Warning: this symbol is deprecated: use Html instead |
 |
property Frame: boolean read FFrame write FFrame default false; |
Draw frame around the text. Frame uses theme image tiLabel, see TCastleTheme.Images if you want to customize it.
|
 |
property MaxWidth: Single read FMaxWidth write SetMaxWidth default 0; |
If non-zero, limit the width of resulting label. The text will be broken in the middle of lines, to make it fit (together with PaddingHorizontal) inside MaxWidth .
|
 |
property VerticalAlignment: TVerticalPosition
read FVerticalAlignment write SetVerticalAlignment default vpBottom; |
Vertical alignment of the text. Usually you don't want to use this, instead leave AutoSize = True and align the label to the parent using anchors, like MyLabel.Anchor(vpMiddle); or MyLabel.Anchor(vpTop); .
This property is useful if you really need to manually control the size. It only matters when AutoSize is False . Then it controls where the text is, with respect to it's rectangle defined by properties like Height or FullSize.
|
 |
property MaxDisplayChars: Integer
read FMaxDisplayChars write SetMaxDisplayChars default -1; |
Limit the displayed label text, if not -1. This doesn't affect the label size, only the rendered text. It's nice to show the animation of text "expanding", filling some area. Use DisplayChars as the maximum sensible value for this.
|
 |
property CaptionTranslate: Boolean read FCaptionTranslate write FCaptionTranslate default true; |
Should the Caption be localized (translated into other languages). Determines if the property is enumerated by TCastleComponent.TranslateProperties, which affects the rest of localization routines.
|
 |
property ColorPersistent: TCastleColorPersistent read FColorPersistent ; |
Color that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Color directly.
See also
- Color
- Text color.
|
 |
property FrameColorPersistent: TCastleColorPersistent read FFrameColorPersistent ; |
FrameColor that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write FrameColor directly.
See also
- FrameColor
- Color tint of the background image, see Frame.
|
Generated by PasDoc 0.16.0.