27-08-2017, 11:23 PM
السلام عليكم ورحمة الله وبركاته
هذه نفس الفكرة ولكن باستخدام combobox و عدد من الbutton
هذه نفس الفكرة ولكن باستخدام combobox و عدد من الbutton
PHP كود :
procedure TForm1.ComboBox1Change(Sender: TObject);
var
i : Integer;
begin
for I := 0 to Form1.ComponentCount -1 do
begin
if Components[i].ClassType = TButton then
if (Components[i] as TButton).Name = ComboBox1.Items[ComboBox1.ItemIndex] then
begin
(Components[i] as TButton).Enabled := False;
end
else
begin
(Components[i] as TButton).Enabled := True;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i : Integer;
begin
for I := 0 to Form1.ComponentCount -1 do
begin
if Components[i].ClassType = TButton then
ComboBox1.items.Add((Components[i] as TButton).Name);
end;
end;


![[-]](https://delphi4arab.net/forum/D4A2020/collapse.png)