TCoreCard

Standalone card component with header, content area, footer with status panels, traffic light indicator, and drag/resize handles. Base class for dashboard cards.

CardDragResizeStatus

Overview

TCoreCard is the base card component providing a complete card structure with header, scrollable content area (TFormContainer), footer with configurable status panels, traffic light indicator, and corner resize handle. It supports pixel-based drag and resize operations with document-level mouse capture.

Component Structure

TCoreCard
├── HeaderDiv
│   ├── DragHandle (6-dot pattern, grab cursor)
│   └── TitleLabel
├── ContentDiv (TFormContainer - scrollable, embeds forms)
├── FooterDiv
│   ├── StatusPanels[0..n] (configurable count)
│   └── TrafficLightDiv (green/orange/red indicator)
└── ResizeHandle (bottom-right corner)

Published Properties

PropertyTypeDefaultDescription
CardTitleSTRING''Title displayed in the header.
CardSubtitleSTRING''Subtitle (used by subclasses like TCoreHeaderCard).
TrafficLightTTrafficLighttlOrangeTraffic light state: tlGreen, tlOrange, tlRed.
ShowFooterBooleanTrueShow/hide the footer section.
ShowTrafficLightBooleanTrueShow/hide the traffic light indicator.
StatusCountInteger4Number of status panels in the footer.
TrafficLightGlowBooleanFalseEnable glow effect on traffic light.
AllowVerticalScrollBooleanTrueAllow content area to scroll vertically.

Traffic Light States

StateDefault ColorUse Case
tlGreen#28a745Good/OK status
tlOrange#fd7e14Warning/Pending status
tlRed#dc3545Error/Critical status

Status Panels

The footer contains configurable status panels - small boxes for displaying status text. Each panel has inset shadow styling and truncates overflow text.

PROCEDURE SetStatusCount(Count: Integer);

Sets the number of status panels.

PROCEDURE SetStatusText(Index: Integer; CONST Text: STRING);

Sets the text for a specific status panel by index (0-based).

FUNCTION GetStatusText(Index: Integer): STRING;

Gets the text from a specific status panel.

Bottom Message

TCoreCard includes TCoreBottomMessage for slide-up notifications:

PROCEDURE ShowBottomMessage(CONST MessageText: STRING; ResultType: TResultType = rtSuccess; Duration: Integer = 2000);

Shows a slide-up message at the bottom of the card. Auto-hides after Duration milliseconds.

Drag & Resize

TCoreCard provides pixel-based drag and resize operations:

Subclass Override: TDashboardGridCard overrides the drag/resize handlers to convert pixel movements to grid cell movements. The handler properties are public to allow this customization.

Event Handler Properties (pas2js)

PropertyDescription
DragHandleMouseDownHandlerHandler for drag handle mousedown
DocumentMouseMoveHandlerHandler for mousemove during drag
DocumentMouseUpHandlerHandler for mouseup after drag
ResizeHandleMouseDownHandlerHandler for resize handle mousedown
ResizeMouseMoveHandlerHandler for mousemove during resize
ResizeMouseUpHandlerHandler for mouseup after resize

Theme Integration

TCoreCard implements IThemeSubscriber. Theme styles applied from:

Usage Example

Card := TCoreCard.Create(Self);
Card.Parent := Self;
Card.CardTitle := 'System Status';
Card.StatusCount := 3;
Card.SetStatusText(0, 'CPU: 45%');
Card.SetStatusText(1, 'Memory: 2.1GB');
Card.SetStatusText(2, 'Uptime: 14d');
Card.SetTrafficLightState(tlGreen, True);  /// Green with glow

/// Show notification
Card.ShowBottomMessage('Settings saved', rtSuccess, 3000);