Reference TScrollGrid
Declared in Codebot.Render.Widgets.pas on line 1087
TScrollGrid = class(TWidget)
protected
function AutoSize: Boolean; override;
function CanSelect: Boolean; override;
procedure Paint(Stage: TPaintStage); override;
procedure DoKeyDown(var Args: TSceneKeyArgs); override;
procedure DoMouseDown(var Args: TSceneMouseArgs); override;
procedure DoMouseMove(var Args: TSceneMouseArgs); override;
procedure DoMouseUp(var Args: TSceneMouseArgs); override;
procedure DoMouseWheel(var Args: TSceneWheelArgs); override;
public
constructor Create(Parent: TWidget; const Name: string = ''); override;
destructor Destroy; override;
{ Select a cell and scroll it into view. A row or column of -1 selects no
cell. }
procedure Select(Col, Row: Integer);
{ Scroll the grid so a cell can be seen }
procedure ScrollToCell(Col, Row: Integer);
{ DrawCell fires OnDrawCell. It is called by the theme for each cell which
can be seen. }
procedure DrawCell(Surface: ICanvas; Row, Col: Integer; const Rect: TRectF);
{ The area holding the cells, inside the frame and scroll bars }
function CellArea: TRectF;
{ The rectangle of a cell, moved by the scroll position }
function CellRect(Col, Row: Integer): TRectF;
{ The cell at a point, returning false if there is none }
function CellFromPoint(X, Y: Float; out Col, Row: Integer): Boolean;
{ True if a scroll bar is showing }
function BarVisible(Bar: TMemoBar): Boolean;
{ The rectangle of a scroll bar }
function BarRect(Bar: TMemoBar): TRectF;
{ The rectangle of the thumb of a scroll bar }
function ThumbRect(Bar: TMemoBar): TRectF;
{ The distance from the left of the first column to the left of a column,
before scrolling }
function ColOffset(Col: Integer): Float;
{ The column at a distance from the left of the first column, which is
ColCount or more when the distance is past the last column }
function ColFromOffset(X: Float): Integer;
{ The whole header, which is as wide as the grid inside its frame. It is
empty if there is no header row. }
function HeaderRect: TRectF;
{ The header cell of a column, moved by the scroll position }
function HeaderCellRect(Col: Integer): TRectF;
{ The column whose header cell is at a point, or -1 if there is none }
function HeaderFromPoint(X, Y: Float): Integer;
{ The column whose right edge can be dragged at a point to resize it, or -1
if there is none }
function DividerFromPoint(X, Y: Float): Integer;
{ The number of pixels the cells are scrolled left and up }
property ScrollX: Float read FScrollX;
property ScrollY: Float read FScrollY;
{ The cell under the mouse, or -1 if there is none }
property HotCol: Integer read FHotCol;
property HotRow: Integer read FHotRow;
{ The number of columns and rows }
property ColCount: Integer read FColCount write SetColCount;
property RowCount: Integer read FRowCount write SetRowCount;
{ The width of a column which has no width of its own, and the height of
every row }
property ColWidth: Float read FColWidth write SetColWidth;
property RowHeight: Float read FRowHeight write SetRowHeight;
{ The width of one column. Until it is set a column is ColWidth wide. }
property ColWidths[Col: Integer]: Float read GetColWidths write SetColWidths;
{ The title shown in the header cell of a column }
property ColTitles[Col: Integer]: string read GetColTitles write SetColTitles;
{ Where the title is placed in the header cell of a column: alignNear for
the left, which is the default, alignCenter, or alignFar for the right }
property ColAligns[Col: Integer]: TWidgetAlign read GetColAligns write SetColAligns;
{ Show a header above the cells, false by default }
property HeaderRow: Boolean read FHeaderRow write SetHeaderRow;
{ The height of the header, which is zero when there is no header row. Until
it is set the header is as tall as the text of the theme with some room
around it. Set it to zero to use that height again. }
property HeaderHeight: Float read GetHeaderHeight write SetHeaderHeight;
{ Allow columns to be resized by dragging the right edge of their header
cells, false by default }
property ColSizing: Boolean read FColSizing write FColSizing;
{ The column whose header cell is under the mouse, or -1 if there is none.
It is used while the grid is hot. }
property HeaderHot: Integer read FHeaderHot;
{ The column whose header cell is held down with the mouse over it, or -1 if
there is none }
property HeaderPressed: Integer read GetHeaderPressed;
{ The column whose header cell shows a sort arrow, or -1 for none, which is
the default. The arrow points up unless SortDescending is true. }
property SortCol: Integer read FSortCol write FSortCol;
property SortDescending: Boolean read FSortDescending write FSortDescending;
{ The selected cell, or -1 if no cell is selected }
property Col: Integer read FCol write SetCol;
property Row: Integer read FRow write SetRow;
{ When GridLines is true the theme draws lines between the cells. It is
false by default. }
property GridLines: Boolean read FGridLines write FGridLines;
{ The colors a list box has in the current theme: the color of text, the
color behind a selected item, and the color of text in a selected item.
They are set by the theme before OnDrawCell is called, for drawing cells
which match a list box. }
property TextColor: TColorF read FTextColor write FTextColor;
property SelectColor: TColorF read FSelectColor write FSelectColor;
property SelectTextColor: TColorF read FSelectTextColor write FSelectTextColor;
{ True if a cell is the selected cell }
function Selected(Row, Col: Integer): Boolean;
{ OnDrawCell fires to draw each cell which can be seen }
property OnDrawCell: TDrawCellEvent read FOnDrawCell write FOnDrawCell;
{ OnHeaderClick fires when a header cell is clicked }
property OnHeaderClick: TGridColEvent read FOnHeaderClick write FOnHeaderClick;
{ OnColResize fires as a column is resized by dragging its header cell }
property OnColResize: TGridColEvent read FOnColResize write FOnColResize;
property OnChange;
property OnClick;
property OnKeyDown;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;See also
Float in Codebot.System.pas
ICanvas in Codebot.Render.Graphics.pas
TColorF in Codebot.Graphics.Types.pas
TRectF in Codebot.Graphics.Types.pas
TSceneKeyArgs in Codebot.Render.Scenes.pas
TSceneMouseArgs in Codebot.Render.Scenes.pas
TSceneWheelArgs in Codebot.Render.Scenes.pas