Class TCastleDesign

Unit

Declaration

type TCastleDesign = class(TCastleUserInterface)

Description

Contents of this user-interface control are loaded from an indicated file (by the Url property).

The file should be in the format created by Castle Game Engine Editor (serialized by CastleComponentSerialize routines) with .castle-user-interface extension.

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public function DesignedComponent(const ComponentName: String; const Required: Boolean = true): TComponent;
Public function FindRequiredComponent(const ComponentName: String): TComponent; deprecated 'use DesignedComponent(ComponentName)';
Public function FindComponent(const ComponentName: String): TComponent; deprecated 'use DesignedComponent(ComponentName, false)';

Properties

Published property Url: String read FUrl write SetUrl;
Published property Stretch: Boolean read GetStretch write SetStretch default true;
Published property RevertUrl: String read FRevertUrl write FRevertUrl;

Description

Methods

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public function PropertySections(const PropertyName: String): TPropertySections; override;

This item has no description. Showing description inherited from TCastleComponent.PropertySections.

Section where to show property in the editor.

Public function DesignedComponent(const ComponentName: String; const Required: Boolean = true): TComponent;

Find by name a component in currently loaded design. When the name is not found, raises exception (unless Required is False, then it returns Nil).

Public function FindRequiredComponent(const ComponentName: String): TComponent; deprecated 'use DesignedComponent(ComponentName)';

Warning: this symbol is deprecated: use DesignedComponent(ComponentName)

This item has no description.

Public function FindComponent(const ComponentName: String): TComponent; deprecated 'use DesignedComponent(ComponentName, false)';

Warning: this symbol is deprecated: use DesignedComponent(ComponentName, false)

This item has no description.

Properties

Published property Url: String read FUrl write SetUrl;

Load file with the user interface design. The file should be in the format created by Castle Game Engine Editor (see CastleComponentSerialize unit) with .castle-user-interface extension. Setting this property automatically unloads the previous design, and loads a new one (if the value is <> '').

After loading a design, you can use DesignedComponent to find the components inside. So e.g. this works:

var
  MyDesign: TCastleDesign;
  MyButton: TCastleButton;
begin
  MyDesign := TCastleDesign.Create(...);
  MyDesign.Url := 'castle-data:/my_user_interface.castle-user-interface';
  MyButton := MyDesign.DesignedComponent('MyButton') as TCastleButton;
  MyButton.OnClick := ...;
end;

Published property Stretch: Boolean read GetStretch write SetStretch default true;

Whether the loaded component (from Url) fills the rectangle of this TCastleDesign instance.

By default this is True, which makes sense if the loaded component can be freely stretched. In this case, the loaded component will have FullSize set to True, so it fills this TCastleDesign instance. And you can control the size of everything by controlling the size of this TCastleDesign instance.

You can set this to False if the loaded component should not be arbitrarily stretched. E.g. maybe it is a TCastleImageControl with TCastleImageControl.Stretch = True. Maybe it is TCastleButton with TCastleButton.AutoSize = True. While every component can be forced to be stretched (by setting FullSize to True), it may look bad in some circumstances. In such case, you should set this property to False. You can also set AutoSizeToChildren to True, to adjust the size of this TCastleDesign instance to the child.

Published property RevertUrl: String read FRevertUrl write FRevertUrl;

URL used to perform editor "Revert" operation.


Generated by PasDoc 0.16.0-snapshot.