Skip to main content

Overview

TRender is the base class for all custom rendering shapes in TeeGrid. It provides the foundation for painting cells, headers, and other grid elements with custom visual representations. The rendering system in TeeGrid includes specialized renderers like TFormatRender, TTextRender, TBooleanRender, TExpanderRender, and TProgressRender. Unit: Tee.Renders.pas

Class Hierarchy

TRender Base Class

Methods

Paint

Renders the visual representation of the cell or element. Parameters:
  • AData: Rendering data containing bounds, painter, data value, and row index
Example:

Hit

Determines if a point (X, Y) is within the renderable area. Parameters:
  • R: Rectangle bounds
  • X, Y: Point coordinates
Returns: True if the point hits the render area

TRenderData Record

The TRenderData record contains all information needed for rendering:

Methods

  • AsBoolean: Converts data to boolean value
  • ClearData: Clears the data string
  • IsEmpty: Checks if data is empty

TFormatRender

Rectangle shape renderer with borders and format support.

Properties

Borders

Left, top, right, and bottom border strokes. Example:

Format

Background and stroke formatting.

Methods

HasFormat

Returns True if format properties are assigned.

StrokeHeight

Calculates the total height of all border strokes.

TTextRender

Rectangle renderer with text, margins, and alignment support.

Properties

Margins

Left, top, right, bottom margins (pixels or %). Example:

TextAlign

Horizontal and vertical text alignment. Example:

Trimming

Text trimming mode and ellipsis settings. Example:

Methods

CalcHeight

Calculates the required height for rendering text. Parameters:
  • APainter: Painter instance for text measurement
  • AText: Text to measure (optional)
Returns: Required height in pixels

TBooleanRender

Checkbox-style renderer for boolean values.

Properties

Style

Values:
  • TBooleanRenderStyle.Check: Checkbox with checkmark
  • TBooleanRenderStyle.Text: Text representation (“True”/“False”)

CheckFormat

Format for the check mark itself. Example:

TExpanderRender

Expander renderer with plus/minus, triangle, or arrow styles.

Properties

Style

Values:
  • TExpanderStyle.PlusMinus: Plus/minus symbols
  • TExpanderStyle.Triangle: Triangle shapes
  • TExpanderStyle.Arrow: Arrow symbols

AlwaysExpand

Always show expand indicator, even if no children.

ExpandFormat

Format for the expand symbol background.

ExpandLine

Stroke for drawing the expand symbol lines.

Events

OnCanExpand

Determines if a row can be expanded.

OnExpand

Fired when expanding/collapsing a row.

OnGetExpanded

Gets the current expanded state. Example:

Methods

Expand

Toggles the expanded state of a row.

PaintLines

Paints hierarchical connection lines.

TProgressRender

Progress bar renderer showing percentage completion.

Properties

Minimum

Minimum value (default: 0).

Maximum

Maximum value (default: 100).

Orientation

Values:
  • TOrientation.Horizontal: Left to right fill
  • TOrientation.Vertical: Bottom to top fill
Example:

TPasswordRender

Text renderer that masks password characters. Example:

TShapePainter Helper

Utility class for painting common shapes.

Methods

Check

Draws a checkmark symbol.

PlusMinus

Draws plus or minus symbol.

Arrow.Down / Arrow.Right

Draws arrow symbols.

Triangle.LeftRight / Triangle.TopBottom

Draws triangle symbols.

Creating Custom Renderers

To create a custom renderer, inherit from TRender or one of its descendants:

See Also