Class TCastleEdit

Unit

Declaration

type TCastleEdit = class(TUIControlFont)

Description

Edit box to input 1 line of text.

Hierarchy

Overview

Fields

Published internal const DefaultWidth = 100;
Published internal const DefaultPadding = 4;

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Render; override;
Public function Rect: TRectangle; override;
Public function Press(const Event: TInputPressRelease): boolean; override;
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
Public function CapturesEventsAtPosition(const Position: TVector2Single): boolean; override;

Properties

Public property FocusedColor: TCastleColor read FFocusedColor write SetFocusedColor;
Public property UnfocusedColor: TCastleColor read FUnfocusedColor write SetUnfocusedColor;
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 Width: Cardinal read FWidth write SetWidth default DefaultWidth;
Published property Text: string read FText write SetText;
Published property PaddingHorizontal: Integer read FPaddingHorizontal write SetPaddingHorizontal default 0;
Published property PaddingVertical: Integer read FPaddingVertical write SetPaddingVertical default 0;
Published property Padding: Integer read FPadding write SetPadding default DefaultPadding;
Published property Frame: boolean read FFrame write SetFrame default true;
Published property CaptureAllInput: boolean read FCaptureAllInput write FCaptureAllInput;

Description

Fields

Published internal const DefaultWidth = 100;
 
Published internal const DefaultPadding = 4;
 

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure Render; override;
 
Public function Rect: TRectangle; override;
 
Public function Press(const Event: TInputPressRelease): boolean; override;
 
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
 
Public function CapturesEventsAtPosition(const Position: TVector2Single): boolean; 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 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 Width: Cardinal read FWidth write SetWidth default DefaultWidth;

Width, in pixels.

Inside it, we will put the border frame (if Frame is True), and padding (see Padding + PaddingHorizontal). So, similar to CSS box model called box-sizing, width includes also padding and border.

Note that the edit control width is never auto-calculated, since there's no "natural width" for the edit box. In contrast, our height is always (for now) auto-calculated.

Published property Text: string read FText write SetText;

Currently input text.

Published property PaddingHorizontal: Integer 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: Integer read FPaddingVertical write SetPaddingVertical default 0;
 
Published property Padding: Integer 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;

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.


Generated by PasDoc 0.14.0.