FIX: Controls alignment

This commit is contained in:
Alexander Koblov 2026-03-07 13:57:40 +03:00
commit f54be93165
4 changed files with 15 additions and 1 deletions

View file

@ -154,6 +154,8 @@ begin
begin
cbDateTimeFormat.Items.Insert(0, DefaultDateTimeFormat);
end;
AlignControlsEx(gbSorting, cbCaseSensitivity, lblCaseSensitivity);
AlignControlsEx(gbFormatting, cbFileSizeFormat, lblFileSizeFormat);
end;
procedure TfrmOptionsFilesViews.Load;

View file

@ -57,7 +57,7 @@ implementation
{$R *.lfm}
uses
DCStrUtils, uGlobs, uLng;
DCStrUtils, uGlobs, uLng, uDCUtils;
const
KeyAction_None = 0;
@ -73,6 +73,7 @@ begin
ParseLineToList(rsOptLetters, cbNoModifier.Items);
cbAlt.Items.Assign(cbNoModifier.Items);
cbCtrlAlt.Items.Assign(cbNoModifier.Items);
AlignControlsEx(gbTyping, cbNoModifier, lblNoModifier);
end;
procedure TfrmOptionsKeyboard.Load;

View file

@ -392,6 +392,7 @@ begin
miImportTCINI.free;
miImportTCBAR.free;
{$ENDIF}
AlignControlsEx(pnlEditControls, cbInternalCommand, lblInternalCommand);
end;
procedure TfrmOptionsToolbarBase.LoadCurrentButton;

View file

@ -238,6 +238,7 @@ procedure UpdateColor(Control: TControl; Checked: Boolean);
function findScaleFactorByFirstForm: Double;
function findScaleFactorByControl( control: TControl ): Double;
procedure EnableControl(Control: TControl; Enabled: Boolean);
procedure AlignControlsEx(AContainer: TWinControl; AComboBox: TComboBox; ALabel: TLabel);
procedure SetComboWidthToLargestElement(AComboBox: TCustomComboBox; iExtraWidthToAdd: integer = 0);
procedure SplitCmdLineToCmdParams(sCmdLine : String; var sCmd, sParams : String);
@ -1304,6 +1305,15 @@ begin
{$ENDIF}
end;
procedure AlignControlsEx(AContainer: TWinControl; AComboBox: TComboBox; ALabel: TLabel);
var
Delta: Integer;
begin
Delta:= AComboBox.Height - ALabel.Height;
AContainer.ChildSizing.VerticalSpacing:= AContainer.ChildSizing.VerticalSpacing + Delta;
AContainer.ChildSizing.TopBottomSpacing:= AContainer.ChildSizing.TopBottomSpacing + Delta;
end;
{ SetComboWidthToLargestElement }
// Set the width of a TComboBox to fit to the largest element in it.
procedure SetComboWidthToLargestElement(AComboBox: TCustomComboBox; iExtraWidthToAdd: integer = 0);