From da21cc71f6cf18e19b73a010073b723540371222 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 5 Mar 2026 15:35:09 -0600 Subject: [PATCH] Add StringGrid control type Co-Authored-By: Claude Opus 4.6 --- forms/README.md | 88 +++++++++++++++++++++++ forms/dfm2form.c | 100 ++++++++++++++++++++++++++- forms/formcli.pas | 173 +++++++++++++++++++++++++++++++++++++++++++++- forms/protocol.md | 39 ++++++++++- 4 files changed, 392 insertions(+), 8 deletions(-) diff --git a/forms/README.md b/forms/README.md index 933b022..c2d9ff5 100644 --- a/forms/README.md +++ b/forms/README.md @@ -336,6 +336,7 @@ messages are available, dispatching each command as it arrives. | `Bevel` | TBevel | Cosmetic beveled line/box | | `Header` | THeader | Column header bar | | `ScrollBox` | TScrollBox | Scrollable container | +| `StringGrid` | TStringGrid | Editable string grid | ### Creating Controls @@ -728,6 +729,91 @@ Input mask string (mask;save literals;blank char). - **Format:** `0` (bsLowered) or `1` (bsRaised) - **Example:** `Style=1` +### ColCount + +- **Applies to:** StringGrid +- **Format:** Integer (default 5) +- **Example:** `ColCount=10` + +Number of columns in the grid. + +### RowCount + +- **Applies to:** StringGrid +- **Format:** Integer (default 5) +- **Example:** `RowCount=20` + +Number of rows in the grid. + +### FixedCols + +- **Applies to:** StringGrid +- **Format:** Integer (default 1) +- **Example:** `FixedCols=1` + +Number of non-scrollable columns on the left. + +### FixedRows + +- **Applies to:** StringGrid +- **Format:** Integer (default 1) +- **Example:** `FixedRows=1` + +Number of non-scrollable rows at the top. + +### DefaultColWidth + +- **Applies to:** StringGrid +- **Format:** Integer (pixels) +- **Example:** `DefaultColWidth=80` + +### DefaultRowHeight + +- **Applies to:** StringGrid +- **Format:** Integer (pixels) +- **Example:** `DefaultRowHeight=20` + +### Options (StringGrid) + +- **Applies to:** StringGrid +- **Format:** Integer (bitmask) +- **Example:** `Options=1549` + +Bitmask of TGridOption values: + +| Bit | Value | Option | Description | +|-----|--------|---------------------|---------------------------| +| 0 | 0x0001 | goFixedVertLine | Vertical lines on fixed | +| 1 | 0x0002 | goFixedHorzLine | Horizontal lines on fixed | +| 2 | 0x0004 | goVertLine | Vertical lines on cells | +| 3 | 0x0008 | goHorzLine | Horizontal lines on cells | +| 4 | 0x0010 | goRangeSelect | Allow range selection | +| 5 | 0x0020 | goDrawFocusSelected | Draw focused cell selected| +| 6 | 0x0040 | goRowSizing | Allow row resizing | +| 7 | 0x0080 | goColSizing | Allow column resizing | +| 8 | 0x0100 | goRowMoving | Allow row moving | +| 9 | 0x0200 | goColMoving | Allow column moving | +| 10 | 0x0400 | goEditing | Allow in-place editing | +| 11 | 0x0800 | goTabs | Tab between cells | +| 12 | 0x1000 | goThumbTracking | Track scrollbar thumb | + +### Cells + +- **Applies to:** StringGrid +- **Format:** Quoted string (tab-delimited columns, `\n`-delimited rows) +- **Example:** `Cells="Name\tAge\nAlice\t30\nBob\t25"` + +Bulk-loads all cell data. Columns are separated by tab characters, +rows by newlines. Row 0 is the first row (typically fixed header). + +### Cell + +- **Applies to:** StringGrid +- **Format:** Quoted string (`col,row,value`) +- **Example:** `Cell="1,2,Hello"` + +Sets a single cell value. Column and row are zero-based indices. + ### BasePath `BasePath` is a property on `TFormClient` (not a protocol property). @@ -766,6 +852,7 @@ No `EVENT.BIND` command is needed. | TabSet | Change | `` | | TabbedNotebook | Change | `` | | MaskEdit | Change | `"new text"` | +| StringGrid | SelectCell | ` ` | ### Opt-in Events @@ -784,6 +871,7 @@ client will send them. Use `EVENT.UNBIND` to disconnect. | MouseDown | `