diff --git a/lcl/lcltaskdialog.pas b/lcl/lcltaskdialog.pas index b5a0edec36..2d27c56629 100644 --- a/lcl/lcltaskdialog.pas +++ b/lcl/lcltaskdialog.pas @@ -799,6 +799,9 @@ var var ARadioOffset: integer; +const + FirstButtonIndex = 100; + FirstRadioButtonIndex = 200; begin if (byte(aCommonButtons)=0) and (Buttons='') then begin aCommonButtons := [cbOk]; @@ -830,8 +833,8 @@ begin Config.pszMainInstruction := PWideChar(_WS(Inst)); Config.pszContent := PWideChar(_WS(Content)); RUCount := 0; - AddRU(Buttons,Config.cButtons,100); - AddRU(Radios,Config.cRadioButtons,200); + AddRU(Buttons,Config.cButtons,FirstButtonIndex); + AddRU(Radios,Config.cRadioButtons,FirstRadioButtonIndex); if Config.cButtons>0 then Config.pButtons := @But[0]; if Config.cRadioButtons>0 then @@ -857,7 +860,7 @@ begin works correctly if nDefaultRadioButton does NOT point to a radiobutton in the pRadioButtons array. } if not (tdfNoDefaultRadioButton in AFlags) then - Config.nDefaultRadioButton := aRadioDef+200; + Config.nDefaultRadioButton := aRadioDef+FirstRadioButtonIndex; Config.cxWidth := MulDiv(aWidth, 4, DialogBaseUnits); // cxWidth needed in "dialog units" Config.pfCallback := @TaskDialogCallbackProc; Config.lpCallbackData := @self; @@ -898,7 +901,7 @@ begin end else if aWidth<120 then aWidth := 120; Dialog.Form.ClientWidth := aWidth; - Dialog.Form.Height := 200; + Dialog.Form.Height := FirstRadioButtonIndex; Dialog.Form.Caption := Title; // create a white panel for the main dialog part Panel := TPanel.Create(Dialog.Form); @@ -1005,7 +1008,7 @@ begin Hint := aHint; // note shown as Hint end; inc(Y,Height+2); - ModalResult := i+100; + ModalResult := i+FirstButtonIndex; OnClick := Dialog.Form.HandleEmulatedButtonClicked; if ModalResult=aButtonDef then Dialog.Form.ActiveControl := CommandLink; @@ -1085,7 +1088,7 @@ begin try Text := SysUtils.trim(Buttons); for i := Count-1 downto 0 do - AddButton(Strings[i],i+100); + AddButton(Strings[i],i+FirstButtonIndex); finally Free; end; @@ -1163,7 +1166,7 @@ begin RadioRes := 0; for i := 0 to high(Rad) do if Rad[i].Checked then - RadioRes := i+200; + RadioRes := i+FirstRadioButtonIndex; finally FreeAndNil(Dialog.Form); end;