Class TStateDialog

Unit

Declaration

type TStateDialog = class abstract(TUIState)

Description

Abstract class for a modal dialog user-interface state. See unit CastleDialogStates documentation for example usage.

Hierarchy

Overview

Nested Types

Protected TButtonArray = array of TCastleButton;

Fields

Public nested const DefaultAlignment = hpLeft;

Methods

Protected function StateContainer: TCastleContainer; override;
Protected procedure InitializeButtons(var Buttons: TButtonArray); virtual;
Protected function DrawInputText: boolean; virtual;
Protected procedure DoAnswered;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Start; override;
Public procedure Stop; override;

Properties

Protected property InputText: string read GetInputText write SetInputText;
Public property InterceptInput default true;
Public property Answered: boolean read FAnswered;
Public property Text: TStrings read FText;
Public property Caption: string read GetCaption write SetCaption stored false;
Public property Alignment: THorizontalPosition read FAlignment write FAlignment default DefaultAlignment;
Public property Html: boolean read FHtml write FHtml default false;
Public property Background: boolean read FBackground write FBackground default false;
Public property BackgroundColor: TCastleColor read FBackgroundColor write FBackgroundColor;
Public property BackgroundScreenshot: boolean read FBackgroundScreenshot write FBackgroundScreenshot default false;
Public property PopOnAnswered: boolean read FPopOnAnswered write FPopOnAnswered default true;
Public property OverrrideContainer: TCastleContainer read FOverrrideContainer write FOverrrideContainer;
Published property BackgroundColorPersistent: TCastleColorPersistent read FBackgroundColorPersistent ;

Description

Nested Types

Protected TButtonArray = array of TCastleButton;
 

Fields

Public nested const DefaultAlignment = hpLeft;
 

Methods

Protected function StateContainer: TCastleContainer; override;
 
Protected procedure InitializeButtons(var Buttons: TButtonArray); virtual;
 
Protected function DrawInputText: boolean; virtual;
 
Protected procedure DoAnswered;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure Start; override;
 
Public procedure Stop; override;
 

Properties

Protected property InputText: string read GetInputText write SetInputText;
 
Public property InterceptInput default true;
 
Public property Answered: boolean read FAnswered;

When user answers the dialog, this is set to True. The state also normally does TUIState.Pop, so there's no need to check this property, unless you set PopOnAnswered to False.

Public property Text: TStrings read FText;

Caption displayed in the dialog.

Public property Caption: string read GetCaption write SetCaption stored false;

Caption displayed in the dialog, as a simple string. 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:

// one way
StateDialogOK.Text.Clear;
StateDialogOK.Text.Add('First line');
StateDialogOK.Text.Add('Second line');

// alternative way to do the same
StateDialogOK.Caption := 'First line' + LineEnding + 'Second line';

Public property Alignment: THorizontalPosition read FAlignment write FAlignment default DefaultAlignment;

Horizontal alignment of the text.

Public property Html: boolean read FHtml write FHtml default false;

Enable a subset of HTML to mark font changes inside the text. See the TCastleAbstractFont.PrintStrings for a description of supported HTML constructs.

Public property Background: boolean read FBackground write FBackground default false;

Obscure the state underneath with our own background (using a color or screenshot).

The obscuring background is defined by BackgroundColor. It may be just a solid opaque color. Or it may be a partially-transparent or even completely transparent color, showing the state underneath (or showing the screenshot of the state underneath, if BackgroundScreenshot).

Public property BackgroundColor: TCastleColor read FBackgroundColor write FBackgroundColor;

Color of the background obscuring the state underneath, if Background is True. This color may be partially-transparent (e.g. to visually "dim" the state underneath) or even completely transparent (alpha 0).

Default is Theme.BackgroundColor, which is dark with alpha = 0.5, so it will dim the state underneath. Sometimes (under exception handler) it's Theme.BackgroundOpaqueColor.

Public property BackgroundScreenshot: boolean read FBackgroundScreenshot write FBackgroundScreenshot default false;

Initialize the background by taking a screenshot of the current screen when the state was started. This screenshot is shown, instead of actually rendering the state underneath, under the BackgroundColor, when Background is True.

This is less functional (when the user scales the window, the screenshot is stretched too), but is safer: it means that the state underneath does not need to be "renderable" anymore.

Public property PopOnAnswered: boolean read FPopOnAnswered write FPopOnAnswered default true;

Should the state do TUIState.Pop when answered. This is usually most natural.

Public property OverrrideContainer: TCastleContainer read FOverrrideContainer write FOverrrideContainer;

Force state to use indicated TCastleContainer to insert itself and get screenshot. By default it uses Application.MainWindow if you use CastleWindow or TCastleControl.MainControl if you use CastleControl.

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
Color of the background obscuring the state underneath, if Background is True.

Generated by PasDoc 0.16.0.