Download Now

    Reference TContentGrid

    Declared in Codebot.Controls.Grids.pas on line 212

    TContentGrid is a grid of cells drawn by event handlers. When SingleColumn is true it acts as a list box.
      TContentGrid = class(TScrollWindow)
      protected
        procedure DoUpdate; override;
        function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
        procedure KeyDown(var Key: Word; Shift: TShiftState); override;
        procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
        procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
        procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
        procedure SelectionScroll(DX, DY: Integer); override;
        procedure Draw; override;
        procedure Resize; override;
        procedure DoOnResize; override;
        { Set the cell under the mouse }
        procedure SetHotTrack(const Value: TGridCoord);
        { OnDrawIndexSection is invoked to draw a section of an item }
        property OnDrawIndexSection: TDrawIndexSectionEvent read FOnDrawIndexSection write FOnDrawIndexSection;
      public
        { Create a new content grid }
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;
        { Repaint a cell }
        procedure InvalidateCoord(X, Y: Integer);
        { Return the bounds of a cell }
        function RectFromCoord(X, Y: Integer): TRect;
        { The cell under the mouse }
        property HotTrack: TGridCoord read FHotTrack;
        { Return the cell at a point }
        function CoordFromPoint(X, Y: Integer): TGridCoord;
        { The width of a column }
        property ColWidths[Col: Integer]: Integer read GetColWidths write SetColWidths;
        { The height of a row }
        property RowHeights[Row: Integer]: Integer read GetRowHeights write SetRowHeights;
        { The selected row when SingleColumn is true, otherwise -1 }
        property ItemIndex: Integer read GetItemIndex write SetItemIndex;
        { The selected cell }
        property Selection: TGridCoord read FSelection write SetSelection;
        { OnMergeCell allows cells to be merged }
        property OnMergeCell: TGridCellMergeEvent read FOnMergeCell write FOnMergeCell;
        property OnScrollChange;
        { When true the first row cannot be selected }
        property FixedRow: Boolean read FFixedRow write SetFixedRow;
      published
        { When true the grid scrolls to show the selected cell }
        property AutoScroll: Boolean read FAutoScroll write FAutoScroll default True;
        { The width of columns which have not been sized }
        property DefColWidth: Integer read GetDefColWidth write SetDefColWidth;
        { The height of rows which have not been sized }
        property DefRowHeight: Integer read GetDefRowHeight write SetDefRowHeight;
        { The number of columns }
        property ColCount: Integer read GetColCount write SetColCount;
        { The number of rows }
        property RowCount: Integer read GetRowCount write SetRowCount;
        { When true the grid has one column and acts as a list box }
        property SingleColumn: Boolean read FSingleColumn write SetSingleColumn default False;
        { OnDrawBackground is invoked to draw behind the cells }
        property OnDrawBackground: TDrawRectEvent read FOnDrawBackground write FOnDrawBackground;
        { OnHitTest allows the part of a cell under the mouse to be determined }
        property OnHitTest: TGridHitTestEvent read FOnHitTest write FOnHitTest;
        { OnSelection is invoked before the selection changes }
        property OnSelection: TGridSelectionEvent read FOnSelection write FOnSelection;
        { OnHotTrack is invoked before the cell under the mouse changes }
        property OnHotTrack: TGridSelectionEvent read FOnHotTrack write FOnHotTrack;
        { OnDrawRow is invoked to draw a row }
        property OnDrawRow: TDrawRowEvent read FOnDrawRow write FOnDrawRow;
        { OnDrawCell is invoked to draw a cell }
        property OnDrawCell: TDrawCellEvent read FOnDrawCell write FOnDrawCell;
        property Align;
        property Anchors;
        property BidiMode;
        property BorderStyle;
        property Color;
        property Constraints;
        property DockSite;
        property DragCursor;
        property DragKind;
        property DragMode;
        property Enabled;
        property Font;
        property ParentColor;
        property ParentFont;
        property ParentShowHint;
        property PopupMenu;
        property ShowHint;
        property TabOrder;
        property TabStop;
        property UseDockManager default True;
        property Visible;
        property OnClick;
        property OnContextPopup;
        property OnDockDrop;
        property OnDockOver;
        property OnDblClick;
        property OnDragDrop;
        property OnDragOver;
        property OnEndDock;
        property OnEndDrag;
        property OnEnter;
        property OnExit;
        property OnGetSiteInfo;
        property OnGetDockCaption;
        property OnMouseDown;
        property OnMouseEnter;
        property OnMouseLeave;
        property OnMouseMove;
        property OnMouseUp;
        property OnMouseWheel;
        property OnMouseWheelDown;
        property OnMouseWheelUp;
        property OnResize;
        property OnStartDock;
        property OnStartDrag;
        property OnUnDock;
      end;

    See also

    TDrawRectEvent in Codebot.Graphics.pas