Class TCastleEdit

Unit

Declaration

type TCastleEdit = class(TCastleUserInterfaceFont)

Description

Edit box to input a single line of text. The contents are in the Text property, you can get or set them at any time.

Note that you should set a suitable TCastleUserInterface.Width of the edit box, to nicely display a typical content. The height is by default auto-calculated (see AutoSizeHeight) looking at font size (and other properties, like padding and frame size), and usually is reasonable automatically.

Hierarchy

Overview

Fields

Published nested const DefaultPadding = 4;
Published nested const DefaultAutoOnScreenKeyboard = false;

Methods

Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override;
Protected function GetInternalText: String; override;
Protected procedure SetInternalText(const Value: String); override;
Protected procedure DoChange; virtual;
Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Render; override;
Public function Press(const Event: TInputPressRelease): boolean; override;
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
Public function CapturesEventsAtPosition(const Position: TVector2): boolean; override;
Public procedure SetFocused(const Value: boolean); override;
Public procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;

Properties

Public property FocusedColor: TCastleColor read FFocusedColor write SetFocusedColor;
Public property UnfocusedColor: TCastleColor read FUnfocusedColor write SetUnfocusedColor;
Public property PlaceholderColor: TCastleColor read FPlaceholderColor write SetPlaceholderColor;
Public property BackgroundColor: TCastleColor read FBackgroundColor write SetBackgroundColor;
Public property AllowedChars: TSetOfChars read FAllowedChars write FAllowedChars;
Public property MaxLength: Cardinal read FMaxLength write FMaxLength;
Published property Text: string read FText write SetText;
Published property PaddingHorizontal: Single read FPaddingHorizontal write SetPaddingHorizontal default 0;
Published property PaddingVertical: Single read FPaddingVertical write SetPaddingVertical default 0;
Published property Padding: Single read FPadding write SetPadding default DefaultPadding;
Published property Frame: boolean read FFrame write SetFrame default true;
Published property CaptureAllInput: boolean read FCaptureAllInput write FCaptureAllInput; deprecated 'use Container.ForceCaptureInput instead of this';
Published property AutoOnScreenKeyboard: Boolean read FAutoOnScreenKeyboard write FAutoOnScreenKeyboard default DefaultAutoOnScreenKeyboard;
Published property AutoSizeHeight: Boolean read FAutoSizeHeight write SetAutoSizeHeight default true;
Published property Placeholder: String read FPlaceholder write SetPlaceholder;
Published property OnChange: TNotifyEvent read FOnChange write FOnChange;
Published property PasswordChar: Char read FPasswordChar write SetPasswordChar default #0;
Published property TextTranslate: Boolean read FTextTranslate write FTextTranslate default true;
Published property PlaceholderTranslate: Boolean read FPlaceholderTranslate write FPlaceholderTranslate default true;
Published property Alignment: THorizontalPosition read FAlignment write SetAlignment default hpLeft;
Published property Enabled: boolean read FEnabled write SetEnabled default true;
Published property FocusedColorPersistent: TCastleColorPersistent read FFocusedColorPersistent ;
Published property UnfocusedColorPersistent: TCastleColorPersistent read FUnfocusedColorPersistent ;
Published property PlaceholderColorPersistent: TCastleColorPersistent read FPlaceholderColorPersistent ;
Published property BackgroundColorPersistent: TCastleColorPersistent read FBackgroundColorPersistent ;

Description

Fields

Published nested const DefaultPadding = 4;
 
Published nested const DefaultAutoOnScreenKeyboard = false;
 

Methods

Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override;
 
Protected function GetInternalText: String; override;
 
Protected procedure SetInternalText(const Value: String); override;
 
Protected procedure DoChange; virtual;
 
Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); override;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure Render; override;
 
Public function Press(const Event: TInputPressRelease): boolean; override;
 
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
 
Public function CapturesEventsAtPosition(const Position: TVector2): boolean; override;
 
Public procedure SetFocused(const Value: boolean); override;
 
Public procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override;
 
Public function PropertySections(const PropertyName: String): TPropertySections; override;
 

Properties

Public property FocusedColor: TCastleColor read FFocusedColor write SetFocusedColor;

Focused text color. By default it's black.

Public property UnfocusedColor: TCastleColor read FUnfocusedColor write SetUnfocusedColor;

Unfocused text color. By default it's dark gray.

Public property PlaceholderColor: TCastleColor read FPlaceholderColor write SetPlaceholderColor;

Color for Placeholder. By default it's light gray.

Public property BackgroundColor: TCastleColor read FBackgroundColor write SetBackgroundColor;

Background color. Fills the area under Text and the padding. By default it's white. Note that it can be transparent, in which case it will show the tiEdit image underneath (if Frame is True), or UI control underneath (if Frame is False).

Public property AllowedChars: TSetOfChars read FAllowedChars write FAllowedChars;

Allowed characters that user can input. Note that this only restricts the user input, it does not prevent from programmatically setting Text to include disallowed characters.

Public property MaxLength: Cardinal read FMaxLength write FMaxLength;

Max length of user input. Value of 0 (default) means "no limit". Note that this only restricts the user input, it does not prevent from programmatically setting Text to be longer.

Published property Text: string read FText write SetText;

Currently input text.

Published property PaddingHorizontal: Single read FPaddingHorizontal write SetPaddingHorizontal default 0;

Inside the box rectangle, padding between the borders (or frame, if Frame) and text. Total horizontal padding is the sum PaddingHorizontal + Padding, total vertical padding is the sum PaddingVertical + Padding.

Published property PaddingVertical: Single read FPaddingVertical write SetPaddingVertical default 0;
 
Published property Padding: Single read FPadding write SetPadding default DefaultPadding;
 
Published property Frame: boolean read FFrame write SetFrame default true;

Draw frame around the box. Frame uses theme image tiEdit, see TCastleTheme.Images if you want to customize it.

Published property CaptureAllInput: boolean read FCaptureAllInput write FCaptureAllInput; deprecated 'use Container.ForceCaptureInput instead of this';

Warning: this symbol is deprecated: use Container.ForceCaptureInput instead of this

Should we capture input regardless of the currently focused control. This is in practice only sensible if this is the only edit box currently visible on the screen.

Published property AutoOnScreenKeyboard: Boolean read FAutoOnScreenKeyboard write FAutoOnScreenKeyboard default DefaultAutoOnScreenKeyboard;

When true, it shows the software keyboard on Android.

Published property AutoSizeHeight: Boolean read FAutoSizeHeight write SetAutoSizeHeight default true;
 
Published property Placeholder: String read FPlaceholder write SetPlaceholder;

Displayed when Text is empty.

Published property OnChange: TNotifyEvent read FOnChange write FOnChange;

Event sent when Text value was changed by a user. Note that this is not called when you change Text property programmatically.

Published property PasswordChar: Char read FPasswordChar write SetPasswordChar default #0;

Show given character (usually "*") instead of actual input characters. Useful for password input fields.

Published property TextTranslate: Boolean read FTextTranslate write FTextTranslate default true;

Should the Text be localized (translated into other languages). Determines if the property is enumerated by TCastleComponent.TranslateProperties, which affects the rest of localization routines.

Published property PlaceholderTranslate: Boolean read FPlaceholderTranslate write FPlaceholderTranslate default true;

Should the Placeholder be localized (translated into other languages). Determines if the property is enumerated by TCastleComponent.TranslateProperties, which affects the rest of localization routines.

Published property Alignment: THorizontalPosition read FAlignment write SetAlignment default hpLeft;

Horizontal alignment of the text.

Published property Enabled: boolean read FEnabled write SetEnabled default true;

Enabled control can be focused and edited, is not grayed-out.

Published property FocusedColorPersistent: TCastleColorPersistent read FFocusedColorPersistent ;

FocusedColor 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 FocusedColor directly.

See also
FocusedColor
Focused text color.
Published property UnfocusedColorPersistent: TCastleColorPersistent read FUnfocusedColorPersistent ;

UnfocusedColor 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 UnfocusedColor directly.

See also
UnfocusedColor
Unfocused text color.
Published property PlaceholderColorPersistent: TCastleColorPersistent read FPlaceholderColorPersistent ;

PlaceholderColor 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 PlaceholderColor directly.

See also
PlaceholderColor
Color for Placeholder.
Published property BackgroundColorPersistent: TCastleColorPersistent read FBackgroundColorPersistent ;

BackgroundColor 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 BackgroundColor directly.

See also
BackgroundColor
Background color.

Generated by PasDoc 0.16.0.