OPM: Automatic height calculation of the options form.

This commit is contained in:
wp_xyz 2022-05-15 17:28:08 +02:00
parent f65e5df223
commit d7ab429d95
2 changed files with 85 additions and 57 deletions

View File

@ -10,12 +10,13 @@ object OptionsFrm: TOptionsFrm
Constraints.MinHeight = 300
Constraints.MinWidth = 475
KeyPreview = True
OnActivate = FormActivate
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyPress = FormKeyPress
PopupMode = pmExplicit
Position = poOwnerFormCenter
LCLVersion = '2.1.0.0'
LCLVersion = '2.3.0.0'
object pnBottom: TPanel
Left = 0
Height = 46
@ -37,7 +38,6 @@ object OptionsFrm: TOptionsFrm
OKButton.OnClick = OKButtonClick
HelpButton.Name = 'HelpButton'
HelpButton.Caption = '&Restore defaults'
HelpButton.DefaultCaption = False
HelpButton.OnClick = HelpButtonClick
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
@ -80,6 +80,7 @@ object OptionsFrm: TOptionsFrm
Width = 100
BorderSpacing.Left = 6
Caption = 'Remote repository:'
Color = clDefault
ParentColor = False
end
object cbForceDownloadExtract: TCheckBox
@ -89,7 +90,7 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 77
Width = 236
Width = 234
BorderSpacing.Top = 2
Caption = ' Force download and extract of packages'
ParentShowHint = False
@ -103,7 +104,7 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 98
Width = 294
Width = 292
BorderSpacing.Top = 2
Caption = 'Delete downloaded zip files after installation/update'
ParentShowHint = False
@ -119,6 +120,7 @@ object OptionsFrm: TOptionsFrm
Width = 146
BorderSpacing.Top = 5
Caption = 'Check for package updates:'
Color = clDefault
ParentColor = False
end
object cbCheckForUpdates: TComboBox
@ -155,6 +157,7 @@ object OptionsFrm: TOptionsFrm
Width = 64
BorderSpacing.Left = 15
Caption = 'Last update:'
Color = clDefault
ParentColor = False
end
object pnRepositories: TPanel
@ -217,6 +220,7 @@ object OptionsFrm: TOptionsFrm
Width = 204
BorderSpacing.Top = 15
Caption = 'Show newly added packages for(days):'
Color = clDefault
ParentColor = False
end
object spDaysToShowNewPackages: TSpinEdit
@ -240,7 +244,7 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 304
Width = 232
Width = 230
BorderSpacing.Top = 10
Caption = 'Show regular icon for installed packages'
TabOrder = 9
@ -252,8 +256,9 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 462
Width = 116
Width = 114
BorderSpacing.Top = 7
BorderSpacing.Bottom = 7
Caption = 'Use default theme'
TabOrder = 11
end
@ -287,6 +292,7 @@ object OptionsFrm: TOptionsFrm
Width = 164
BorderSpacing.Top = 16
Caption = 'Connection timeout(seconds): '
Color = clDefault
ParentColor = False
ParentShowHint = False
ShowHint = True
@ -371,7 +377,7 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 119
Width = 227
Width = 225
BorderSpacing.Top = 2
Caption = 'Warn me about incompatible packages'
ParentShowHint = False
@ -385,7 +391,7 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 140
Width = 242
Width = 240
BorderSpacing.Top = 2
Caption = 'Warn me about already installed packages'
ParentShowHint = False
@ -399,7 +405,7 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 19
Top = 56
Width = 230
Width = 228
BorderSpacing.Top = 6
Caption = 'If available, parse json from local source'
ParentShowHint = False
@ -410,24 +416,24 @@ object OptionsFrm: TOptionsFrm
end
object tsProxy: TTabSheet
Caption = 'Proxy'
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
object pnProxy: TPanel
Left = 0
Height = 470
Height = 511
Top = 0
Width = 615
Width = 624
Align = alClient
BevelOuter = bvNone
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
ParentColor = False
TabOrder = 0
object cbProxy: TCheckBox
Left = 8
Height = 19
Top = 15
Width = 71
Width = 70
Caption = 'Use Proxy'
OnChange = cbProxyChange
TabOrder = 0
@ -464,6 +470,7 @@ object OptionsFrm: TOptionsFrm
Top = 3
Width = 32
Caption = 'Server'
Color = clDefault
ParentColor = False
end
object lbUserName: TLabel
@ -476,6 +483,7 @@ object OptionsFrm: TOptionsFrm
Width = 53
BorderSpacing.Top = 6
Caption = 'Username'
Color = clDefault
ParentColor = False
end
object edProxyUser: TEdit
@ -499,6 +507,7 @@ object OptionsFrm: TOptionsFrm
Top = 3
Width = 22
Caption = 'Port'
Color = clDefault
ParentColor = False
end
object lbPassword: TLabel
@ -511,6 +520,7 @@ object OptionsFrm: TOptionsFrm
Width = 50
BorderSpacing.Left = 6
Caption = 'Password'
Color = clDefault
ParentColor = False
end
object edProxyPassword: TEdit
@ -546,8 +556,8 @@ object OptionsFrm: TOptionsFrm
end
object tsOpenSSL: TTabSheet
Caption = 'OpenSSL'
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
object rbOpenSSL: TRadioGroup
AnchorSideLeft.Control = tsOpenSSL
AnchorSideTop.Control = tsOpenSSL
@ -556,7 +566,7 @@ object OptionsFrm: TOptionsFrm
Left = 10
Height = 113
Top = 10
Width = 595
Width = 604
Anchors = [akTop, akLeft, akRight]
AutoFill = True
BorderSpacing.Left = 10
@ -571,7 +581,7 @@ object OptionsFrm: TOptionsFrm
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 93
ClientWidth = 591
ClientWidth = 600
Items.Strings = (
'Automatically download files'
'Show confirmation dialog before download'
@ -582,17 +592,17 @@ object OptionsFrm: TOptionsFrm
end
object tsFolders: TTabSheet
Caption = 'Folders'
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
object pnFolders: TPanel
Left = 0
Height = 470
Height = 511
Top = 0
Width = 615
Width = 624
Align = alClient
BevelOuter = bvNone
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
ParentColor = False
TabOrder = 0
object lbLocalRepositoryPackages: TLabel
@ -601,6 +611,7 @@ object OptionsFrm: TOptionsFrm
Top = 16
Width = 84
Caption = 'Local repository'
Color = clDefault
ParentColor = False
ParentShowHint = False
end
@ -614,6 +625,7 @@ object OptionsFrm: TOptionsFrm
Width = 125
BorderSpacing.Top = 12
Caption = 'Local repository archive'
Color = clDefault
ParentColor = False
ParentShowHint = False
end
@ -627,6 +639,7 @@ object OptionsFrm: TOptionsFrm
Width = 124
BorderSpacing.Top = 12
Caption = 'Local repository update'
Color = clDefault
ParentColor = False
ParentShowHint = False
end
@ -639,7 +652,7 @@ object OptionsFrm: TOptionsFrm
Left = 8
Height = 23
Top = 35
Width = 601
Width = 610
Directory = 'edLocalRepositoryPackages'
ShowHidden = False
ButtonWidth = 23
@ -664,7 +677,7 @@ object OptionsFrm: TOptionsFrm
Left = 8
Height = 23
Top = 89
Width = 601
Width = 610
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -686,7 +699,7 @@ object OptionsFrm: TOptionsFrm
Left = 8
Height = 23
Top = 143
Width = 601
Width = 610
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -702,28 +715,28 @@ object OptionsFrm: TOptionsFrm
end
object tsProfiles: TTabSheet
Caption = 'Profiles'
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
object pnProfiles: TPanel
Left = 0
Height = 470
Height = 511
Top = 0
Width = 615
Width = 624
Align = alClient
BevelOuter = bvNone
ClientHeight = 470
ClientWidth = 615
ClientHeight = 511
ClientWidth = 624
ParentColor = False
TabOrder = 0
object pnProfilesTop: TPanel
Left = 0
Height = 48
Top = 0
Width = 615
Width = 624
Align = alTop
BevelOuter = bvNone
ClientHeight = 48
ClientWidth = 615
ClientWidth = 624
TabOrder = 0
OnResize = pnProfilesTopResize
object lbSelectProfile: TLabel
@ -732,6 +745,7 @@ object OptionsFrm: TOptionsFrm
Top = 15
Width = 68
Caption = 'Select profile'
Color = clDefault
ParentColor = False
end
object cbSelectProfile: TComboBox
@ -760,25 +774,25 @@ object OptionsFrm: TOptionsFrm
end
object pnProfilesMain: TPanel
Left = 0
Height = 422
Height = 463
Top = 48
Width = 615
Width = 624
Align = alClient
BevelOuter = bvNone
ClientHeight = 422
ClientWidth = 615
ClientHeight = 463
ClientWidth = 624
TabOrder = 1
OnResize = pnProfilesMainResize
object pnProfilesLeft: TPanel
AnchorSideLeft.Control = pnProfilesMain
AnchorSideTop.Control = pnProfilesMain
Left = 0
Height = 422
Height = 463
Top = 0
Width = 282
Align = alLeft
BevelOuter = bvNone
ClientHeight = 422
ClientHeight = 463
ClientWidth = 282
TabOrder = 0
object lbExcludeFiles: TListBox
@ -789,7 +803,7 @@ object OptionsFrm: TOptionsFrm
AnchorSideBottom.Control = pnProfilesLeft
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 393
Height = 434
Top = 23
Width = 190
Anchors = [akTop, akLeft, akRight, akBottom]
@ -809,10 +823,11 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 15
Top = 4
Width = 117
Width = 119
BorderSpacing.Left = 6
BorderSpacing.Top = 4
Caption = 'Exclude file extensions'
Color = clDefault
ParentColor = False
end
object bFilesAdd: TButton
@ -867,14 +882,14 @@ object OptionsFrm: TOptionsFrm
end
object pnProfilesRight: TPanel
Left = 282
Height = 422
Height = 463
Top = 0
Width = 327
Width = 336
Align = alClient
BorderSpacing.Right = 6
BevelOuter = bvNone
ClientHeight = 422
ClientWidth = 327
ClientHeight = 463
ClientWidth = 336
TabOrder = 1
object lbExcludeFolders: TListBox
AnchorSideLeft.Control = lbFilterDirs
@ -884,9 +899,9 @@ object OptionsFrm: TOptionsFrm
AnchorSideBottom.Control = pnProfilesRight
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 393
Height = 434
Top = 23
Width = 235
Width = 244
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 4
BorderSpacing.Right = 6
@ -904,10 +919,11 @@ object OptionsFrm: TOptionsFrm
Left = 6
Height = 15
Top = 4
Width = 79
Width = 80
BorderSpacing.Left = 6
BorderSpacing.Top = 4
Caption = 'Exclude folders'
Color = clDefault
ParentColor = False
end
object bFoldersAdd: TButton
@ -915,7 +931,7 @@ object OptionsFrm: TOptionsFrm
AnchorSideTop.Control = lbExcludeFolders
AnchorSideRight.Control = pnProfilesRight
AnchorSideRight.Side = asrBottom
Left = 247
Left = 256
Height = 25
Top = 23
Width = 80
@ -933,7 +949,7 @@ object OptionsFrm: TOptionsFrm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pnProfilesRight
AnchorSideRight.Side = asrBottom
Left = 247
Left = 256
Height = 25
Top = 52
Width = 80
@ -951,7 +967,7 @@ object OptionsFrm: TOptionsFrm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pnProfilesRight
AnchorSideRight.Side = asrBottom
Left = 247
Left = 256
Height = 25
Top = 81
Width = 80
@ -968,7 +984,7 @@ object OptionsFrm: TOptionsFrm
end
end
object SDD: TSelectDirectoryDialog
left = 448
top = 280
Left = 448
Top = 280
end
end

View File

@ -124,6 +124,7 @@ type
procedure cbSelectProfileChange(Sender: TObject);
procedure edLocalRepositoryPackagesButtonClick(Sender:TObject);
procedure edRemoteRepositoryKeyPress(Sender: TObject; var Key: char);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: char);
@ -346,6 +347,17 @@ begin
OKButtonClick(bpOptions.OKButton);
end;
procedure TOptionsFrm.FormActivate(Sender: TObject);
var
h: Integer;
delta: Integer;
begin
h := cbUseDefaultTheme.Top + cbUseDefaultTheme.Height + cbUseDefaultTheme.BorderSpacing.Bottom;
delta := h - pgOptions.ClientHeight;
ClientHeight := pgOptions.Top + pgOptions.Height + delta + pgOptions.BorderSpacing.Around +
bpOptions.Height + bpOptions.BorderSpacing.Around;
end;
procedure TOptionsFrm.FormCreate(Sender: TObject);
begin
FHintFormOptionColors := TStringList.Create;