Coder Social home page Coder Social logo

teegrid's Introduction

TeeGrid

<www.steebi.com>

Lightweight full-featured Grid / Tabular control

For Embarcadero Studio, Delphi and C++, VCL and Firemonkey frameworks and Lazarus FreePascal

Written from scratch (not derived from TCustomGrid or TGrid), aprox 5K lines of code and 64K compiled size.

Links

Full source code and automatic installer:

Download latest version

Release Notes (What's new?)

Google+ Community

Website: http://www.steebi.com

Install

Automatically:

  • Run TeeGridRecompile.exe

Manually:

  • Open TeeGrid project group from Sources\Packages
  • Right-click DCLVCLTeeGrid package, and do "Install"
  • Right-click DCLFMXTeeGrid package, and do "Install"

Using TeeGrid

TeeGrid is "data-agnostic"

Data must be provided to TeeGrid using a data provider class, manually created.

The reason is TeeGrid has no dependencies on database units (DB.pas) or any TDataset component.

This enables linking a TeeGrid to any kind of data, like a TDataset, TDataSource, arrays of objects or records or a generic TList using Rtti, a TCollection, TeeBI TDataItem structures or any other source, including your own custom "virtual data" class.

Note: Support for "TDataset" or "TDataSource" components at design-time is not yet implemented.

Several classes are provided to bind data to TeeGrid, like:

  • TVirtualData in Tee.Grid.Data unit (for arrays, generic TList etc)

  • TVirtualDBData in Tee.Grid.Data.DB unit (for TDataSource and TDataSet)

  • TBIGridData in BI.Grid.Data unit (for TeeBI TDataItem objects)

Examples:

// From a TDataSource:
TeeGrid1.Data:= TVirtualDBData.From(DataSource1);

// From an array:
var MyData : Array of TPerson; 
... fill array...
TeeGrid1.Data:=TVirtualData<TPerson>.Create(MyData);

// From a TeeBI TDataItem:
var MyData : TDataItem;
MyData := TStore.Load('SQLite_Demo')['Products'];
TeeGrid1.Data := TBIGridData.Create(TeeGrid1.Grid, MyData );

Current Features

  • Virtual data

TVirtualData or derived class to automatically create columns and provide cell values

  • Sub-columns (any column can have children columns)
TeeGrid1.Columns.AddColumn('My Column 1').Items.AddColumn('Sub-Column 1')...
  • Per-column formatting (font, back fill, stroke, text alignment)
TeeGrid1.Columns[3].Format.Font.Size:= 14;
  • Individual row heights (per-row custom height)
TeeGrid1.Rows.Heights[3]:= 50; 
  • Custom cell rendering

Default class for cell rendering is TCellRender. Other classes can be used or created to override the default behaviour, like for example to show check-boxes in columns with boolean (True/False) values:

TeeGrid1.Columns[7].Render:= TBooleanRender.Create; 
  • Cell text format (float, date-time formatting strings)
TeeGrid1.Columns[0].FloatFormat:= '0.###'; 
  • Column Visible and Expanded (for sub-columns)
TeeGrid1.Columns[0].Visible:= False; 
TeeGrid1.Columns[0].Items[3].Expanded:= False; // visible, but collapsed
  • Automatic column width (or fixed, in pixels or % percent of grid width)
TeeGrid1.Columns[0].Width.Automatic:= False; 
TeeGrid1.Columns[0].Width.Value:= 40; 
TeeGrid1.Columns[0].Width.Units:= TSizeUnits.Percent;
  • Column mouse drag resizing

Dragging the left mouse button in a column header edge resizes it

  • Automatic scroll bars visibility

Scrollbars are automatically displayed when necessary. In Firemonkey they can be customized:

TeeGrid1.ScrollBars.Vertical.Width:=50;
  • Column ordering

Columns and sub-columns can be re-positioned:

TeeGrid1.Columns[2].Index:= 0;  // move 2nd column to first (left-most) position
  • Grid Header formatting (font, back fill, stroke)
TeeGrid1.Columns[0].Header.Text:= 'My Column';
TeeGrid1.Columns[0].Header.Format.Font.Color:= TAlphaColors.Red;
  • Grid Header mouse-hover
TeeGrid1.Header.Hover.Visible:= True;
TeeGrid1.Header.Hover.Format.Brush.Color:= TAlphaColors.Green;
  • Grid "indicator" column (left-most column with symbol for current row)
TeeGrid1.Indicator.Visible:= True; // <-- False to hide indicator
TeeGrid1.Indicator.Width:= 20;
  • Row highlighting (mouse-hover and selected row formatting)
// selection
TeeGrid1.Selected.Column:= TeeGrid1.Columns[3];
TeeGrid1.Selected.Row:= 5;
  
// formatting
TeeGrid1.Selected.ParentFont:= False;
TeeGrid1.Selected.Format.Font.Style:= [TFontStyle.fsBold];
  • Full selected row highlight
TeeGrid1.Selected.FullRow:=True;
  • Grid and Columns ReadOnly
TeeGrid1.ReadOnly:= False;
TeeGrid1.Columns[0].ReadOnly:= True;
  • Custom Grid editors

Note: Edit box for texts in current beta version.

TeeGrid1.Columns[1].EditorClass:= TCalendarEditor;
  • Rows and Columns lines separators (stroke settings)
TeeGrid1.Lines.Rows.Visible:= True;
TeeGrid1.Lines.Rows.Size:= 3;
TeeGrid1.Lines.Rows.Color:= TAlphaColors.Skyblue;
  • Cell mouse-hover (highlights cell under mouse cursor)

Cell (or all cells in row) under mouse cursor can be highlighted:

TeeGrid1.Cells.Hover.Visible:= True;
TeeGrid1.Cells.Hover.FullRow:= True;
TeeGrid1.Cells.Hover.Format.Stroke.Size:= 2;
  • All coordinates as floats

For sub-pixel finetuning, Firemonkey only. VCL always rounds to integer pixels.

TeeGrid1.Header.Height.Automatic:=False;
TeeGrid1.Header.Height.Value:=124.3;   // sub-pixels, decimals
  • Alternate row background filling (back brush, stroke settings)
TeeGrid1.Rows.Alternate.Brush.Visible:= True;
TeeGrid1.Rows.Alternate.Brush.Color:= TAlphaColors.Lightcoral;
TeeGrid1.Rows.Alternate.Stroke.Visible:= True;
  • Events

The usual Onxxx events:

OnAfterDraw OnClickHeader OnColumnResized OnEditing OnEdited

  • Abstract Grid "Painter" (canvas)

TeeGrid Painter property is of TPainter class. This is an abstract class that can be overriden, for example to use GDI+ in VCL:

TeeGrid1.Painter:= TGDIPlusPainter.Create; // <-- Note: not yet in beta version
  • Design-time editor dialog to modify all settings and properties

Several editor dialogs, for both VCL and Firemonkey, usable at design-time and runtime to modify all TeeGrid properties like columns, formatting, etc

uses VCLTee.Editor.Grid;
TTeeGridEditor.Edit(Self,TeeGrid1);

Wish-List, Pending Features

  • TDataSource / TDataSet support

Improve TVirtualDBData class to support DB buffering and events

  • Easy embeddable controls in cells or rows.

To for example display sub-grids or TeeCharts below a row or inside a cell.

  • Image / Picture display in cells and header

  • Compositions (several texts, images, etc inside the same cell)

  • Column mouse-drag to reorder columns

  • Buttons at header to expand / collapse sub-columns

  • Row groups (with expand / collapse)

  • Automatic row sorting, filtering and searching

Note: Row sorting, filtering and searching is already possible with TeeBI TBIGrid control.

teegrid's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.