From 2d5ed2a3b114dd8f868df11fbd627be31f97abdd Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Wed, 4 Mar 2026 20:02:03 -0600 Subject: [PATCH] Add Image, GroupBox, RadioButton, Panel, ScrollBar, and MediaPlayer control types Extends the remote forms system from 7 to 13 control types across dfm2form converter, formcli client engine, and documentation. Image and MediaPlayer support file paths resolved via BasePath. MediaPlayer adds a Command pseudo-property for method calls. RadioButton auto-wires Click; ScrollBar auto-wires Change. Co-Authored-By: Claude Opus 4.6 --- forms/README.md | 229 ++++++++++++++++++++++++++++++---- forms/dfm2form.c | 261 ++++++++++++++++++++++++++++++++++++-- forms/formcli.pas | 311 ++++++++++++++++++++++++++++++++++++++++++++-- forms/protocol.md | 86 +++++++++---- 4 files changed, 825 insertions(+), 62 deletions(-) diff --git a/forms/README.md b/forms/README.md index 1f37ae9..b564f7d 100644 --- a/forms/README.md +++ b/forms/README.md @@ -307,15 +307,21 @@ messages are available, dispatching each command as it arrives. ## Supported Controls -| Type | Delphi Class | Description | -|------------|-------------|--------------------------------| -| `Label` | TLabel | Static text label | -| `Edit` | TEdit | Single-line text input | -| `Button` | TButton | Push button | -| `CheckBox` | TCheckBox | Check box with label | -| `ListBox` | TListBox | Scrollable list of items | -| `ComboBox` | TComboBox | Drop-down list with text input | -| `Memo` | TMemo | Multi-line text input | +| Type | Delphi Class | Description | +|---------------|--------------|--------------------------------| +| `Label` | TLabel | Static text label | +| `Edit` | TEdit | Single-line text input | +| `Button` | TButton | Push button | +| `CheckBox` | TCheckBox | Check box with label | +| `ListBox` | TListBox | Scrollable list of items | +| `ComboBox` | TComboBox | Drop-down list with text input | +| `Memo` | TMemo | Multi-line text input | +| `Image` | TImage | Bitmap image display (BMP only)| +| `GroupBox` | TGroupBox | Cosmetic grouping frame | +| `RadioButton` | TRadioButton | Radio button (one group/form) | +| `Panel` | TPanel | Cosmetic container panel | +| `ScrollBar` | TScrollBar | Horizontal or vertical scrollbar| +| `MediaPlayer` | TMediaPlayer | MCI media player control | ### Creating Controls @@ -353,11 +359,12 @@ CTRL.SET 1 3 Text="world" Enabled=0 ### Caption -- **Applies to:** Label, Button, CheckBox +- **Applies to:** Label, Button, CheckBox, GroupBox, RadioButton, Panel - **Format:** Quoted string - **Example:** `Caption="Submit"` -The display text for labels, buttons, and check boxes. +The display text for labels, buttons, check boxes, group boxes, radio +buttons, and panels. ### Text @@ -383,7 +390,7 @@ new items are added. ### Checked -- **Applies to:** CheckBox +- **Applies to:** CheckBox, RadioButton - **Format:** `0` (unchecked) or `1` (checked) - **Example:** `Checked=1` @@ -432,12 +439,168 @@ Maximum number of characters the user can type. ### TabOrder -- **Applies to:** All windowed controls (all types except Label) +- **Applies to:** All windowed controls (all types except Label and Image) - **Format:** Integer - **Example:** `TabOrder=3` Controls the keyboard tab navigation order within the form. +### Stretch + +- **Applies to:** Image +- **Format:** `0` (off) or `1` (on) +- **Example:** `Stretch=1` + +When enabled, the image is stretched to fill the control bounds. + +### Center + +- **Applies to:** Image +- **Format:** `0` (off) or `1` (on) +- **Example:** `Center=1` + +When enabled, the image is centered within the control bounds. + +### Transparent + +- **Applies to:** Image +- **Format:** `0` (off) or `1` (on) +- **Example:** `Transparent=1` + +When enabled, the image background is transparent. + +### Picture + +- **Applies to:** Image +- **Format:** Quoted string (filename) +- **Example:** `Picture="images\logo.bmp"` + +BMP file to display. The path is resolved relative to the client's +`BasePath` setting. Subdirectories are allowed. + +**Note:** `dfm2form` does not emit Picture from DFM files because +image data is stored as a binary blob in the DFM. Set Picture at +runtime via `CTRL.SET` or by manually editing the `.form` file. + +### BevelOuter + +- **Applies to:** Panel +- **Format:** Integer 0-2 +- **Values:** + - `0` — bvNone + - `1` — bvLowered + - `2` — bvRaised +- **Example:** `BevelOuter=2` + +### BevelInner + +- **Applies to:** Panel +- **Format:** Integer 0-2 +- **Values:** + - `0` — bvNone + - `1` — bvLowered + - `2` — bvRaised +- **Example:** `BevelInner=1` + +### BorderStyle (Panel) + +- **Applies to:** Panel +- **Format:** `0` (bsNone) or `1` (bsSingle) +- **Example:** `BorderStyle=1` + +### Kind + +- **Applies to:** ScrollBar +- **Format:** `0` (sbHorizontal) or `1` (sbVertical) +- **Example:** `Kind=1` + +### Min + +- **Applies to:** ScrollBar +- **Format:** Integer +- **Example:** `Min=0` + +### Max + +- **Applies to:** ScrollBar +- **Format:** Integer +- **Example:** `Max=100` + +### Position + +- **Applies to:** ScrollBar +- **Format:** Integer +- **Example:** `Position=50` + +### LargeChange + +- **Applies to:** ScrollBar +- **Format:** Integer +- **Example:** `LargeChange=10` + +The amount the position changes when the user clicks the scroll bar +track. + +### SmallChange + +- **Applies to:** ScrollBar +- **Format:** Integer +- **Example:** `SmallChange=1` + +The amount the position changes when the user clicks an arrow button. + +### FileName + +- **Applies to:** MediaPlayer +- **Format:** Quoted string (file path) +- **Example:** `FileName="sounds\intro.wav"` + +Media file to open. The path is resolved relative to the client's +`BasePath` setting. + +### DeviceType + +- **Applies to:** MediaPlayer +- **Format:** Quoted string +- **Example:** `DeviceType="dtWaveAudio"` + +MCI device type. Valid values: `dtAutoSelect`, `dtAVIVideo`, +`dtCDAudio`, `dtDAT`, `dtDigitalVideo`, `dtMMMovie`, `dtOther`, +`dtOverlay`, `dtScanner`, `dtSequencer`, `dtVCR`, `dtVideodisc`, +`dtWaveAudio`. + +### AutoOpen + +- **Applies to:** MediaPlayer +- **Format:** `0` (off) or `1` (on) +- **Example:** `AutoOpen=1` + +When enabled, the media file is opened automatically when FileName +is set. + +### Command + +- **Applies to:** MediaPlayer +- **Format:** Quoted string +- **Example:** `Command="Play"` + +Pseudo-property that triggers a method call instead of setting a +value. Valid commands: `Open`, `Play`, `Stop`, `Close`, `Pause`, +`Resume`, `Rewind`, `Next`, `Previous`. + +### BasePath + +`BasePath` is a property on `TFormClient` (not a protocol property). +Set it before loading forms to specify where file-based properties +(Picture, FileName) resolve relative paths. Example: + +```pascal +Client.BasePath := 'C:\MYAPP'; +``` + +A Picture value of `"images\logo.bmp"` then resolves to +`C:\MYAPP\images\logo.bmp`. + ## Events ### Auto-wired Events @@ -449,8 +612,10 @@ No `EVENT.BIND` command is needed. |-------------|---------|-------------------------------| | Button | Click | (none) | | CheckBox | Click | (none) | +| RadioButton | Click | (none) | | Edit | Change | `"new text"` | | Memo | Change | `"new text"` | +| ScrollBar | Change | `` | | ListBox | Select | ` "selected text"` | | ComboBox | Select | ` "selected text"` | | ComboBox | Change | `"new text"` | @@ -460,16 +625,18 @@ No `EVENT.BIND` command is needed. These events require an explicit `EVENT.BIND` command before the client will send them. Use `EVENT.UNBIND` to disconnect. -| Event | Data Sent | Notes | -|-----------|-----------------------|---------------------------------| -| DblClick | (none) | Double-click on any control | -| KeyDown | `` | Windows virtual key code | -| KeyUp | `` | Windows virtual key code | -| Enter | (none) | Control received focus | -| Exit | (none) | Control lost focus | -| MouseDown | `