LCL: in TRadioGroup and TCheckGroup don't set the name for runtime created radiobuttons/checkboxes.

They are not needed and can give rise to unexpected crashes if the name already exists.
This commit is contained in:
Bart 2023-05-20 14:50:19 +02:00
parent 5137735655
commit d405afa039
2 changed files with 0 additions and 8 deletions

View File

@ -249,10 +249,7 @@ begin
for i:=0 to FItems.Count-1 do begin
CheckBox:=TCheckBox(FButtonList[i]);
CheckBox.Caption:=FItems[i];
CheckBox.Name := '';
end;
for i:=0 to FButtonList.Count-1 do
TCheckBox(FButtonList[i]).Name:='CheckBox'+IntToStr(i);
finally
FUpdatingItems:=false;
end;
@ -426,7 +423,6 @@ begin
if (Idx <> -1) and (Idx < Items.Count) then
begin
FButtonList.Delete(Idx);
AComponent.Name := ''; //otherwise we get duplicate name error in UpdateItems
Items.Delete(Idx);
end;
end;

View File

@ -228,10 +228,7 @@ begin
ARadioButton := TRadioButton(FButtonList[i]);
ARadioButton.Checked := (i = FItemIndex);
ARadioButton.Visible := true;
ARadioButton.Name := '';
end;
for i:=0 to FButtonList.Count-1 do
TRadioButton(FButtonList[i]).Name:='RadioButton'+IntToStr(i);
//FHiddenButton must remain the last item in Controls[], so that Controls[] is in sync with Items[]
Self.RemoveControl(FHiddenButton);
@ -479,7 +476,6 @@ begin
if (Idx <> -1) and (Idx < Items.Count) then
begin
FButtonList.Delete(Idx);
AComponent.Name := '';
Items.Delete(Idx);
end;
end;