Tina4 Delphi – Quick Reference
Installation
# Clone the repository
git clone https://github.com/tina4stack/tina4delphi.git
# Open Tina4DelphiProject in Delphi IDE
# Build and install Tina4Delphi, then Tina4DelphiDesignMore details on requirements, SSL setup, and project configuration.
Quick Wins
No components needed – just add Tina4Core to your uses clause and start using these utilities immediately.
Fetch JSON from any REST API in one line:
var StatusCode: Integer;
var Response := SendHttpRequest(StatusCode, 'https://api.example.com', '/products');
var Products := BytesToJSONObject(Response);
// Products is now a TJSONObject you can iterate, bind to grids, etc.Turn any database query into JSON:
var JSON := GetJSONFromDB(FDConnection1, 'SELECT * FROM customers WHERE active = 1');
// {"records": [{"id": "1", "firstName": "Andre", "email": "andre@test.com"}, ...]}
// Field names are auto-converted to camelCase, dates to ISO 8601, blobs to Base64Populate a MemTable from JSON – no manual field defs needed:
PopulateMemTableFromJSON(FDMemTable1, 'records',
'{"records": [{"id": "1", "name": "Alice"}, {"id": "2", "name": "Bob"}]}');
// FDMemTable1 is now a live dataset – bind it to a grid, filter it, export itUpload files with multipart form data:
var StatusCode: Integer;
SendMultipartFormData(StatusCode,
'https://api.example.com', 'upload/avatar',
['userId', '1001', 'caption', 'Profile photo'], // form fields
['avatar', 'C:\photos\me.jpg']); // file to uploadMore details on string helpers, dates, encoding, JSON, database, and HTTP utilities.
REST Client
Drop a TTina4REST on your form and configure base URL and auth. Other components reference this for HTTP calls.
Tina4REST1.BaseUrl := 'https://api.example.com/v1';
Tina4REST1.SetBearer('eyJhbGciOiJIUzI1NiJ9...');
var StatusCode: Integer;
var Response := Tina4REST1.Get(StatusCode, '/users', 'page=1&limit=10');More details on authentication, HTTP methods, and response handling.
REST Request
Links to a TTina4REST and executes REST calls with automatic MemTable population.
// Design-time: set Tina4REST, EndPoint, DataKey, MemTable
Tina4RESTRequest1.ExecuteRESTCall;
// FDMemTable1 is now populated with the response dataMore details on POST bodies, master/detail, async execution, and events.
JSON Adapter
Populates a TFDMemTable from static JSON or from a REST request master source.
Tina4JSONAdapter1.MemTable := FDMemTable1;
Tina4JSONAdapter1.DataKey := 'products';
Tina4JSONAdapter1.JSONData.Text := '{"products": [{"id": "1", "name": "Widget"}]}';
Tina4JSONAdapter1.Execute;More details on MasterSource linking and sync modes.
HTML Renderer
An FMX control that parses and renders HTML with CSS support directly on a canvas.
Tina4HTMLRender1.HTML.Text := '<h1>Hello</h1><p>This is <b>bold</b> and <i>italic</i>.</p>';More details on supported HTML/CSS, form controls, events, DOM manipulation, and Twig integration.
Page Navigation
Design-time SPA-style page navigation using TTina4HTMLRender.
Tina4HTMLPages1.Renderer := Tina4HTMLRender1;
var Page := Tina4HTMLPages1.Pages.Add;
Page.PageName := 'home';
Page.IsDefault := True;
Page.HTMLContent.Text := '<h1>Home</h1><a href="#about">Go to About</a>';More details on Twig pages, programmatic navigation, and events.
Twig Templates
A Twig-compatible template engine for rendering dynamic HTML.
var Twig := TTina4Twig.Create('C:\templates');
try
Twig.SetVariable('name', 'Andre');
Memo1.Lines.Text := Twig.Render('<h1>Hello {{ name }}</h1>');
finally
Twig.Free;
end;More details on template syntax, filters, and functions.
Core Utilities
Tina4Core.pas provides standalone utility functions for JSON, dates, encoding, HTTP, and database operations.
// Convert between naming conventions
CamelCase('first_name'); // 'firstName'
SnakeCase('firstName'); // 'first_name'
// Date validation and conversion
IsDate('2024-01-15T10:30:00.000Z'); // True
GetJSONDate(Now); // '2024-06-15T14:30:00.000Z'
// Base64 encoding
var B64 := FileToBase64('C:\photos\avatar.jpg');More details on all available utility functions.
Working with Claude AI
Tina4 Delphi ships with an MCP (Model Context Protocol) server that gives Claude Code the ability to compile, run, preview, and interact with Pascal/Delphi applications directly from the CLI.
Install the MCP server:
# From the tina4delphi repository
cd claude-pascal-mcp
uv syncAdd it to your Claude Code settings (.mcp.json or project-level):
{
"mcpServers": {
"pascal-dev": {
"command": "uv",
"args": ["run", "--directory", "/path/to/tina4delphi/claude-pascal-mcp", "pascal-mcp"]
}
}
}What Claude can do with the MCP server:
- Compile Pascal – compile single-file code or full Delphi projects (DPR + PAS + DFM)
- Project Templates – generate proper Delphi project structure with components and event handlers
- Run Programs – compile and execute console programs, capturing stdout/stderr
- Launch GUI Apps – compile and run VCL/FMX applications in the background
- Live Preview – see running desktop apps through Claude's preview panel via an HTTP bridge
- Click Buttons – interact with controls by enumerating child windows and sending clicks directly
- Move & Resize – reposition and resize application windows programmatically
- Type & Send Keys – enter text and send keyboard shortcuts to running apps
- Parse Forms – read
.dfm,.fmx, or.lfmform files and understand component structure - Auto-detect Compilers – finds Free Pascal, Delphi 7 (dcc32), and RAD Studio (dcc64)
- Specify Compiler Path – use any compiler by passing its full path
Preview Bridge – Claude can see your running desktop app through its built-in preview panel. Add this to .claude/launch.json:
{
"version": "0.0.1",
"configurations": [
{
"name": "pascal-preview",
"runtimeExecutable": "/path/to/.venv/Scripts/pythonw.exe",
"runtimeArgs": ["-m", "pascal_mcp.preview_bridge"],
"port": 18080,
"autoPort": true
}
]
}This means Claude can write Delphi code, compile it, launch the app, see it running, click buttons, verify behavior, and fix issues — all without leaving the conversation.