Class TCastleCheckbox
Unit
Declaration
type TCastleCheckbox = class(TCastleUserInterface)
Description
Checkbox with a caption.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleCheckbox
Overview
Fields
nested const DefaultCaptionMargin = 10; |
|
nested const DefaultCheckboxSize = 24; |
Methods
procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override; |
|
function GetInternalText: String; override; |
|
procedure SetInternalText(const Value: String); override; |
|
procedure DoChange; virtual; |
|
procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); override; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
function Press(const Event: TInputPressRelease): boolean; override; |
|
function Release(const Event: TInputPressRelease): boolean; override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override; |
Properties
property TextColor: TCastleColor read FTextColor write SetTextColor; |
|
property CheckboxColor: TCastleColor read FCheckboxColor write SetCheckboxColor; |
|
property Checked: Boolean read FChecked write SetChecked default false; |
|
property Caption: String read FCaption write SetCaption; |
|
property CaptionTranslate: Boolean read FCaptionTranslate write FCaptionTranslate default true; |
|
property CaptionMargin: Single read FCaptionMargin write SetCaptionMargin
default DefaultCaptionMargin; |
|
property OnChange: TNotifyEvent read FOnChange write FOnChange; |
|
property AutoSize: Boolean read FAutoSize write SetAutoSize default true; |
|
property FontSize: Single read FFontSize write SetFontSize default 0.0; |
|
property CheckboxSize: Single read FCheckboxSize write SetCheckboxSize
default DefaultCheckboxSize; |
|
property CustomFont: TCastleAbstractFont
read GetCustomFont write SetCustomFont; |
|
property TextColorPersistent: TCastleColorPersistent read FTextColorPersistent ; |
|
property CheckboxColorPersistent: TCastleColorPersistent read FCheckboxColorPersistent ; |
Description
Fields
nested const DefaultCaptionMargin = 10; |
|
This item has no description. |
nested const DefaultCheckboxSize = 24; |
|
This item has no description. |
Methods
procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.PreferredSize. Controls that have a preferred size should override this. By default this contains values derived from Width, WidthFraction, Height, HeightFraction, with Border subtracted. Note that the arguments should be already scaled, i.e. multiplied by UIScale, i.e. expressed in final device pixels. Note that the returned PreferredWidth and PreferredHeight must not include the space for Border. Border size will be added later. |
function GetInternalText: String; override; |
|
This item has no description. |
procedure SetInternalText(const Value: String); override; |
|
This item has no description. |
procedure DoChange; virtual; |
|
This item has no description. |
procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); override; |
|
This item has no description. Showing description inherited from TCastleComponent.TranslateProperties. Enumerate all properties that are possible to translate in this component. E.g. in TCastleLabel it will return TCastleLabel.Caption, in TCastleEdit it will return TCastleEdit.Text and TCastleEdit.Placeholder. Returns only non-empty properties, thus assuming that if current (by convention, English) text is empty, then there is no point in translating it. Moreover descendants may define boolean properties to exclude particular text from translating, e.g. TCastleLabel.CaptionTranslate, TCastleEdit.TextTranslate, TCastleEdit.PlaceholderTranslate. It is not recursive (it doesn't enumerate children properties). Use global TranslateProperties procedure to call this on a hierarchy of TComponent. You usually don't want to call this method (it is called by other engine routines). But you may find it useful to override this, if you define new component. |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
function Press(const Event: TInputPressRelease): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Press.
Override this method to react to user pressing a key, mouse button or mouse wheel. Return When implementing in descendants it is best to override it like this: function TMyControl.Press(const Event: TInputPressRelease): boolean; begin Result := inherited; if Result then Exit; // exit if ancestor already handled this event if Event.IsKey(keyEnter) then begin // do something in reaction to Enter key ... // let engine know that this input event was handled Exit(true); end; if Event.IsMouseButton(buttonLeft) then begin // do something in reaction to left mouse button press ... // let engine know that this input event was handled Exit(true); end; end;
These events are generated for all UI controls, whether they are considered "interactive" or not. These events are generated for non-interactive controls like TCastleRectangleControl or TCastleLabel as well. For example, these events ignore the TCastleButton.Enabled state, they are generated always (see https://github.com/castle-engine/castle-engine/issues/413 ). Use instead TCastleButton.OnClick to detect clicks on a button in a way that honors the TCastleButton.Enabled state. When a control returns The events Press and Release are passed to the parent only after the children had a chance to process this event. Overriding them makes sense if you draw something that "looks clickable" in TCastleUserInterface.Render, which is the standard place you should draw stuff. For example our TCastleButton draws there. In contrast, the events PreviewPress and PreviewRelease are passed first to the parent control, before children have a chance to process this event. In partcular, overriding them makes sense if you draw something that "looks clickable" in TCastleUserInterface.RenderOverChildren. |
function Release(const Event: TInputPressRelease): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Release.
Override this method to react to user releasing a key, mouse button. Return This is counterpart to Press method. See Press for more details. Note: We'd like this method to also be called when user releases a mouse wheel. But currently releasing of the mouse wheel is not reported now by any backend. Only releasing of keys and mouse buttons is reported. |
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. |
procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.EditorAllowResize. Override this to prevent resizing some dimension in CGE editor. |
Properties
property TextColor: TCastleColor read FTextColor write SetTextColor; |
|
Color of the label. By default opaque black. |
property CheckboxColor: TCastleColor read FCheckboxColor write SetCheckboxColor; |
|
Color of the checkbox square and checkmark. By default opaque black. |
property Checked: Boolean read FChecked write SetChecked default false; |
|
This item has no description. |
property Caption: String read FCaption write SetCaption; |
|
This item has no description. |
property CaptionTranslate: Boolean read FCaptionTranslate write FCaptionTranslate default true; |
|
Should the Caption be localized (translated into other languages). Determines if the property is enumerated by TCastleComponent.TranslateProperties, which affects the rest of localization routines. |
property CaptionMargin: Single read FCaptionMargin write SetCaptionMargin
default DefaultCaptionMargin; |
|
Margin between checkbox square and a text Caption. |
property OnChange: TNotifyEvent read FOnChange write FOnChange; |
|
Event sent when Checked value was changed by a user click. Note that this is not called when you change Checked property programmatically. |
property AutoSize: Boolean read FAutoSize write SetAutoSize default true; |
|
Should our size be determined by checkbox image size and caption. |
property FontSize: Single read FFontSize write SetFontSize default 0.0; |
|
Caption font size. |
property CheckboxSize: Single read FCheckboxSize write SetCheckboxSize
default DefaultCheckboxSize; |
|
Size of the square checkbox. |
property CustomFont: TCastleAbstractFont
read GetCustomFont write SetCustomFont; |
|
Font used for the caption. When this is |
property TextColorPersistent: TCastleColorPersistent read FTextColorPersistent ; |
|
TextColor 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 TextColor directly. See also
|
property CheckboxColorPersistent: TCastleColorPersistent read FCheckboxColorPersistent ; |
|
CheckboxColor 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 CheckboxColor directly. See also
|
Generated by PasDoc 0.16.0-snapshot.