Class TCastleTableView
Unit
Declaration
type TCastleTableView = class(TCastleScrollView)
Description
Warning: this symbol is deprecated: use instead TCastleVerticalGroup with children as TCastleHorizontalGroup to create a table layout
TableView control to show lists in GUI. The usage is similar as in iOS TableView or Android ListView - you have to pass a data source (implement ICastleTableViewDataSource
interface), and TableView control takes care of the rest. TableView control descends from TCastleScrollView, so it shows the scrollbar when needed.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleScrollViewCustom
- TCastleScrollView
- TCastleTableView
Overview
Fields
![]() |
nested const DefaultCellHeight = 50; |
Methods
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
destructor Destroy; override; |
![]() |
procedure ReloadData; |
![]() |
procedure SetDataSource(ADataSource: ICastleTableViewDataSource); |
![]() |
function Press(const Event: TInputPressRelease): boolean; override; |
![]() |
function Release(const Event: TInputPressRelease): boolean; override; |
![]() |
function Motion(const Event: TInputMotion): boolean; override; |
![]() |
procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override; |
Properties
![]() |
property DataSource: ICastleTableViewDatasource read FDataSource write SetDataSource; |
![]() |
property OnSelectCell: TTableViewDidSelectCellEvent
read FOnDidSelectCell write FOnDidSelectCell; |
![]() |
property CellHeight: Integer read FCellHeight write FCellHeight default DefaultCellHeight; |
Description
Fields
![]() |
nested const DefaultCellHeight = 50; |
This item has no description. |
Methods
![]() |
constructor Create(AOwner: TComponent); override; |
This item has no description. |
![]() |
destructor Destroy; override; |
This item has no description. |
![]() |
procedure ReloadData; |
This item has no description. |
![]() |
procedure SetDataSource(ADataSource: ICastleTableViewDataSource); |
This item has no description. |
![]() |
function Press(const Event: TInputPressRelease): boolean; override; |
This item has no description. Showing description inherited from TCastleUserInterface.Press.
Handle press or release of 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 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. 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. Note that releasing of the mouse wheel is not reported now by any backend. Only releasing of keys and mouse buttons is reported. |
![]() |
function Release(const Event: TInputPressRelease): boolean; override; |
This item has no description. |
![]() |
function Motion(const Event: TInputMotion): boolean; override; |
This item has no description. Showing description inherited from TCastleUserInterface.Motion.
|
![]() |
procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override; |
This item has no description. Showing description inherited from TCastleUserInterface.Update. Control may do here anything that must be continuously repeated. E.g. camera handles here falling down due to gravity, rotating model in Examine mode, and many more.
This method may be used, among many other things, to continuously react to the fact that user pressed some key (or mouse button). For example, if holding some key should move some 3D object, you should do something like: if HandleInput then begin if Container.Pressed[keyArrowRight] then Transform.Position := Transform.Position + Vector3(SecondsPassed * 10, 0, 0); HandleInput := false; end;
Instead of directly using a key code, consider also using TInputShortcut that makes the input key nicely configurable. See engine tutorial about handling inputs. Multiplying movement by SecondsPassed makes your operation frame-rate independent. Object will move by 10 units in a second, regardless of how many FPS your game has. The code related to HandleInput is important if you write a generally-useful control that should nicely cooperate with all other controls, even when placed on top of them or under them. The correct approach is to only look at pressed keys/mouse buttons if HandleInput is Note that to handle a single press / release (like "switch light on when pressing a key") you should rather use Press and Release methods. Use this method only for continuous handling (like "holding this key makes the light brighter and brighter"). To understand why such HandleInput approach is needed, realize that the "Update" events are called differently than simple mouse and key events like "Press" and "Release". "Press" and "Release" events return whether the event was somehow "handled", and the container passes them only to the controls under the mouse (decided by TCastleUserInterface.CapturesEventsAtPosition). And as soon as some control says it "handled" the event, other controls (even if under the mouse) will not receive the event. This approach is not suitable for Update events. Some controls need to do the Update job all the time, regardless of whether the control is under the mouse and regardless of what other controls already did. So all controls (well, all controls that exist, in case of TCastleUserInterface, see TCastleUserInterface.Exists) receive Update calls. So the "handled" status is passed through HandleInput. If a control is not under the mouse, it will receive HandleInput = |
Properties
![]() |
property DataSource: ICastleTableViewDatasource read FDataSource write SetDataSource; |
TableView needs data source set in order to show some contents. |
![]() |
property OnSelectCell: TTableViewDidSelectCellEvent
read FOnDidSelectCell write FOnDidSelectCell; |
Event called when cell was selected by user. |
![]() |
property CellHeight: Integer read FCellHeight write FCellHeight default DefaultCellHeight; |
Height of all cells. |
Generated by PasDoc 0.16.0.