IDE: Apply global DropDownCount to TCustomComboBox derivatives in options dialog. Issue #40250, patch by n7800.

This commit is contained in:
Juha 2023-05-07 10:11:15 +03:00
parent 4e6acc2a82
commit d4ab7a94a5
4 changed files with 29 additions and 6 deletions

View File

@ -1,10 +1,10 @@
object DesktopOptionsFrame: TDesktopOptionsFrame
Left = 0
Height = 523
Height = 542
Top = 0
Width = 596
ClientHeight = 523
ClientWidth = 596
Width = 650
ClientHeight = 542
ClientWidth = 650
TabOrder = 0
Visible = False
DesignLeft = 351
@ -468,7 +468,10 @@ object DesktopOptionsFrame: TDesktopOptionsFrame
Width = 75
BorderSpacing.Left = 6
BorderSpacing.Top = 3
MinValue = 5
MaxValue = 100
MinValue = 3
ParentShowHint = False
ShowHint = True
TabOrder = 13
Value = 8
end

View File

@ -79,7 +79,6 @@ type
private
function LangIDToCaption(const LangID: string): string;
function CaptionToLangID(const ACaption: string): string;
procedure DoLoadSettings(AOptions: TAbstractIDEOptions);
procedure DoSaveSettings(AOptions: TAbstractIDEOptions);
public
@ -166,6 +165,7 @@ begin
// comboboxes
lblComboBoxes.Caption := lisComboBoxes;
lblDropDownCount.Caption := lisDropDownCount;
spDropDownCount.Hint := lisDropDownCountHint;
end;
procedure TDesktopOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);

View File

@ -135,6 +135,22 @@ implementation
{$R *.lfm}
procedure SetDropDownCount(AWinControl: TWinControl);
// Set global DropDownCount to all TCustomComboBox descendants under AWinControl.
var
i: integer;
begin
for i := 0 to AWinControl.ControlCount - 1 do
begin
if AWinControl.Controls[i] is TCustomComboBox then
TCustomComboBox(AWinControl.Controls[i]).DropDownCount :=
EnvironmentOptions.DropDownCount;
// recursive call
if AWinControl.Controls[i] is TWinControl then
SetDropDownCount(TWinControl(AWinControl.Controls[i]));
end;
end;
{ TIDEOptionsDialog }
constructor TIDEOptionsDialog.Create(AOwner: TComponent);
@ -229,6 +245,7 @@ begin
if Assigned(AEditor) then begin
AEditor.Align := alClient;
AEditor.BorderSpacing.Around := 6;
SetDropDownCount(AEditor); ///TEST
AEditor.Visible := True;
end;
FPrevEditor := AEditor;
@ -339,6 +356,8 @@ begin
if EnvironmentOptions.Desktop.SingleTaskBarButton
then Application.TaskBarBehavior := tbSingleButton
else Application.TaskBarBehavior := tbDefault;
// update DropDownCount property immediately
SetDropDownCount(EditorsPanel);
end;
procedure TIDEOptionsDialog.OkButtonClick(Sender: TObject);

View File

@ -1320,6 +1320,7 @@ resourcestring
lisImportEnvironmentOptions = 'Import environment options';
lisComboBoxes = 'Combo Boxes';
lisDropDownCount = 'Drop Down Count';
lisDropDownCountHint = 'Used for all ComboBoxes in IDE dialogs';
// Desktop options
dlgManageDesktops = 'Manage desktops';