Class TViewDialog
Unit
Declaration
type TViewDialog = class abstract(TCastleView)
Description
Abstract class for a modal dialog user-interface view. See unit CastleDialogViews documentation for example usage.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleView
- TViewDialog
Overview
Nested Types
TButtonArray = array of TCastleButton; |
Fields
nested const DefaultAlignment = hpLeft; |
Methods
procedure InitializeButtons(var Buttons: TButtonArray); virtual; |
|
function DrawInputText: boolean; virtual; |
|
procedure DoAnswered; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
procedure Start; override; |
|
procedure Stop; override; |
|
procedure SaveScreenIfNecessary(const AContainer: TCastleContainer); |
Properties
property InputText: String read GetInputText write SetInputText; |
|
property InterceptInput default true; |
|
property Answered: boolean read FAnswered; |
|
property Text: TStrings read FText; |
|
property Caption: String read GetCaption write SetCaption stored false; |
|
property Alignment: THorizontalPosition
read FAlignment write FAlignment default DefaultAlignment; |
|
property Html: boolean read FHtml write FHtml default false; |
|
property Background: boolean read FBackground write FBackground default false; |
|
property BackgroundColor: TCastleColor read FBackgroundColor write FBackgroundColor; |
|
property BackgroundScreenshot: boolean
read FBackgroundScreenshot write FBackgroundScreenshot default false; |
|
property PopOnAnswered: boolean
read FPopOnAnswered write FPopOnAnswered default true; |
|
property BackgroundColorPersistent: TCastleColorPersistent read FBackgroundColorPersistent ; |
Description
Nested Types
TButtonArray = array of TCastleButton; |
|
This item has no description. |
Fields
nested const DefaultAlignment = hpLeft; |
|
This item has no description. |
Methods
procedure InitializeButtons(var Buttons: TButtonArray); virtual; |
|
This item has no description. |
function DrawInputText: boolean; virtual; |
|
This item has no description. |
procedure DoAnswered; |
|
This item has no description. |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. Showing description inherited from TCastleView.Create. Create an instance of the view. You willl typically create one instance of each view class (like TViewMain, TViewPlay) at the application initialization (e.g. in Application.OnInitialize callback), like ViewMainMenu := TViewMainMenu.Create(Application); ViewPlay := TViewPlay.Create(Application);
Later you switch between views using TCastleContainer.View or TCastleContainer.PushView or TCastleContainer.PopView, like this: Container.View := ViewMain;
See https://castle-engine.io/views and numerous engine examples. |
destructor Destroy; override; |
|
This item has no description. |
procedure Start; override; |
|
This item has no description. Showing description inherited from TCastleView.Start. Executed when view becomes active, it's now part of the view stack. Started view is part of the ViewStack, and will soon become running (top-most on the stack). When the view is set to be current, by
|
procedure Stop; override; |
|
This item has no description. Showing description inherited from TCastleView.Stop. Executed when view is no longer active, no longer part of view stack. When the view stops becoming active, this happens:
This is always called to finalize the started view. When the view is destroyed, it's Pause and Stop are called too, so you can use this method to reliably finalize whatever you initialized in Start. |
procedure SaveScreenIfNecessary(const AContainer: TCastleContainer); |
|
Save screen now to be used by subsequent Start. Does a screenshot only if our current properties (Background, BackgroundScreenshot, BackgroundColor) indicate screenshot is needed. It allows to make a screenshot earlier than at Start call. |
Properties
property InputText: String read GetInputText write SetInputText; |
|
This item has no description. |
property InterceptInput default true; |
|
This item has no description. Showing description inherited from TCastleView.InterceptInput. Prevents passing mouse/keyboard events to the UI views underneath. More precisely, when this property is Note that setting this to function TMyView.Press(const Event: TInputPressRelease): Boolean; begin Result := inherited; // ignore the ancestor result, as we use InterceptInput, so ancestor always returns true // if Result the Exit; if Event.IsMouseButton(buttonLeft) then begin ... Exit(true); end; end; |
property Answered: boolean read FAnswered; |
|
When user answers the dialog, this is set to |
property Text: TStrings read FText; |
|
Caption displayed in the dialog. |
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 ViewDialogOK.Text.Clear; ViewDialogOK.Text.Add('First line'); ViewDialogOK.Text.Add('Second line'); // alternative way to do the same ViewDialogOK.Caption := 'First line' + LineEnding + 'Second line'; |
property Alignment: THorizontalPosition
read FAlignment write FAlignment default DefaultAlignment; |
|
Horizontal alignment of the text. |
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. |
property Background: boolean read FBackground write FBackground default false; |
|
Obscure the view 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 view underneath (or showing the screenshot of the view underneath, if BackgroundScreenshot). |
property BackgroundColor: TCastleColor read FBackgroundColor write FBackgroundColor; |
|
Color of the background obscuring the view underneath, if Background is Default is Theme.BackgroundColor, which is dark with alpha = 0.5, so it will dim the view underneath. Sometimes (under exception handler) it's Theme.BackgroundOpaqueColor. |
property BackgroundScreenshot: boolean
read FBackgroundScreenshot write FBackgroundScreenshot default false; |
|
Initialize the background by taking a screenshot of the current screen when the view was started. This screenshot is shown, instead of actually rendering the view underneath, under the BackgroundColor, when Background is This is less functional (when the user scales the window, the screenshot is stretched too), but is safer: it means that the view underneath does not need to be "renderable" anymore. |
property PopOnAnswered: boolean
read FPopOnAnswered write FPopOnAnswered default true; |
|
Should the view do TCastleContainer.PopView when answered. This is usually most natural. |
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
|
Generated by PasDoc 0.16.0-snapshot.