From a5fb1e5588f86df0b7bd0fd7f35aac5d03d60ba0 Mon Sep 17 00:00:00 2001 From: Ugochukwu Mmaduekwe Date: Thu, 29 Oct 2026 13:00:28 +0100 Subject: [PATCH] Lay out the Delphi mobile test host to fill the screen The form used a fixed 360 dp design with absolute positions, so controls stopped short of the right edge on phones and the log scrolled sideways. It now uses a padded root layout that takes the system-bar insets from the platform, full-width controls, and a word-wrapping log. --- .../Mobile/MobileTestHostFormUnit.fmx | 180 +++++++++++------- .../Mobile/MobileTestHostFormUnit.pas | 11 +- 2 files changed, 125 insertions(+), 66 deletions(-) diff --git a/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.fmx b/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.fmx index 0922a6b..67da199 100644 --- a/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.fmx +++ b/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.fmx @@ -8,73 +8,123 @@ object MobileTestHostForm: TMobileTestHostForm FormFactor.Height = 480 FormFactor.Devices = [Desktop] OnShow = FormShow + OnSafeAreaChanged = FormSafeAreaChanged DesignerMasterStyle = 3 - object lblBaseUrl: TLabel - AutoSize = True - Position.X = 8.000000000000000000 - Position.Y = 26.000000000000000000 - Size.Width = 177.000000000000000000 - Size.Height = 22.000000000000000000 + object layRoot: TLayout + Align = Client + Size.Width = 360.000000000000000000 + Size.Height = 606.000000000000000000 Size.PlatformDefault = False - Text = 'TestInsight URL' - TabOrder = 4 - end - object edtBaseUrl: TEdit - Touch.InteractiveGestures = [LongTap, DoubleTap] - Anchors = [akLeft, akTop, akRight, akBottom] TabOrder = 0 - Position.X = 8.000000000000000000 - Position.Y = 56.000000000000000000 - Size.Width = 344.000000000000000000 - Size.Height = 32.000000000000000000 - Size.PlatformDefault = False - TextPrompt = 'http://IP:PORT' - OnChange = edtBaseUrlChange - OnChangeTracking = edtBaseUrlChange - end - object btnSaveUrl: TButton - Enabled = False - Position.X = 8.000000000000000000 - Position.Y = 114.000000000000000000 - Size.Width = 89.000000000000000000 - Size.Height = 44.000000000000000000 - Size.PlatformDefault = False - TabOrder = 1 - Text = 'Save URL' - OnClick = btnSaveUrlClick - end - object lblConnection: TLabel - AutoSize = True - Position.X = 8.000000000000000000 - Position.Y = 222.000000000000000000 - Size.Width = 344.000000000000000000 - Size.Height = 22.000000000000000000 - Size.PlatformDefault = False - Text = 'IDE: (status)' - TabOrder = 5 - end - object btnRunTests: TButton - Enabled = False - Position.X = 8.000000000000000000 - Position.Y = 166.000000000000000000 - Size.Width = 89.000000000000000000 - Size.Height = 44.000000000000000000 - Size.PlatformDefault = False - TabOrder = 2 - Text = 'Run Tests' - OnClick = btnRunTestsClick - end - object memLog: TMemo - Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] - DataDetectorTypes = [] - Anchors = [akLeft, akTop, akRight, akBottom] - Position.X = 8.000000000000000000 - Position.Y = 264.000000000000000000 - Size.Width = 344.000000000000000000 - Size.Height = 334.000000000000000000 - Size.PlatformDefault = False - TabOrder = 3 - Viewport.Width = 336.000000000000000000 - Viewport.Height = 326.000000000000000000 + object layContent: TLayout + Align = Client + Padding.Left = 16.000000000000000000 + Padding.Top = 16.000000000000000000 + Padding.Right = 16.000000000000000000 + Padding.Bottom = 16.000000000000000000 + Size.Width = 360.000000000000000000 + Size.Height = 606.000000000000000000 + Size.PlatformDefault = False + TabOrder = 0 + object lblBaseUrl: TLabel + Align = Top + AutoSize = True + Margins.Bottom = 8.000000000000000000 + Size.Width = 328.000000000000000000 + Size.Height = 22.000000000000000000 + Size.PlatformDefault = False + Text = 'TestInsight URL' + TabOrder = 0 + end + object edtBaseUrl: TEdit + Touch.InteractiveGestures = [LongTap, DoubleTap] + Align = Top + TabOrder = 1 + Margins.Bottom = 12.000000000000000000 + Size.Width = 328.000000000000000000 + Size.Height = 44.000000000000000000 + Size.PlatformDefault = False + TextPrompt = 'http://IP:PORT' + OnChange = edtBaseUrlChange + OnChangeTracking = edtBaseUrlChange + end + object grdButtons: TGridPanelLayout + Align = Top + Margins.Bottom = 12.000000000000000000 + Size.Width = 328.000000000000000000 + Size.Height = 44.000000000000000000 + Size.PlatformDefault = False + TabOrder = 2 + ColumnCollection = < + item + Value = 50.000000000000000000 + end + item + Value = 50.000000000000000000 + end> + ControlCollection = < + item + Column = 0 + Control = btnSaveUrl + Row = 0 + end + item + Column = 1 + Control = btnRunTests + Row = 0 + end> + RowCollection = < + item + Value = 100.000000000000000000 + end> + object btnSaveUrl: TButton + Align = Client + Enabled = False + Margins.Right = 4.000000000000000000 + Size.Width = 160.000000000000000000 + Size.Height = 44.000000000000000000 + Size.PlatformDefault = False + TabOrder = 0 + Text = 'Save URL' + OnClick = btnSaveUrlClick + end + object btnRunTests: TButton + Align = Client + Enabled = False + Margins.Left = 4.000000000000000000 + Size.Width = 160.000000000000000000 + Size.Height = 44.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + Text = 'Run Tests' + OnClick = btnRunTestsClick + end + end + object lblConnection: TLabel + Align = Top + AutoSize = True + Margins.Bottom = 12.000000000000000000 + Size.Width = 328.000000000000000000 + Size.Height = 22.000000000000000000 + Size.PlatformDefault = False + Text = 'IDE: (status)' + TabOrder = 3 + end + object memLog: TMemo + Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] + DataDetectorTypes = [] + StyledSettings = [Style, FontColor] + TextSettings.Font.Family = 'monospace' + TextSettings.Font.Size = 13.000000000000000000 + WordWrap = True + Align = Client + Size.Width = 328.000000000000000000 + Size.Height = 398.000000000000000000 + Size.PlatformDefault = False + TabOrder = 4 + Viewport.Width = 324.000000000000000000 + Viewport.Height = 394.000000000000000000 + end + end end end diff --git a/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.pas b/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.pas index 4e9ae3c..3b3554a 100644 --- a/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.pas +++ b/SimpleBaseLib.Tests/Delphi.Tests/Mobile/MobileTestHostFormUnit.pas @@ -4,19 +4,23 @@ interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, - FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, + FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Layouts, FMX.Controls.Presentation, FMX.Edit, FMX.Memo.Types, FMX.ScrollBox, FMX.Memo, MobileTestRunner; type TMobileTestHostForm = class(TForm) + layRoot: TLayout; + layContent: TLayout; lblBaseUrl: TLabel; edtBaseUrl: TEdit; + grdButtons: TGridPanelLayout; btnSaveUrl: TButton; lblConnection: TLabel; btnRunTests: TButton; memLog: TMemo; procedure FormShow(Sender: TObject); + procedure FormSafeAreaChanged(Sender: TObject; const AInsets: TRectF); procedure edtBaseUrlChange(Sender: TObject); procedure btnSaveUrlClick(Sender: TObject); procedure btnRunTestsClick(Sender: TObject); @@ -35,6 +39,11 @@ implementation {$R *.fmx} +procedure TMobileTestHostForm.FormSafeAreaChanged(Sender: TObject; const AInsets: TRectF); +begin + layRoot.Padding.Rect := AInsets; +end; + procedure TMobileTestHostForm.AppendLog(const ALine: string); begin if ALine <> '' then