まず、onselect 中にコンボボックス 1 でコンボボックス 2 を埋めていました。私は長い道のりを始めました。以下を参照してください。
procedure TFGetZoneDept.ComboBox1Select(Sender: TObject);
begin
Combobox2.Clear;
with Combobox1 do
begin
if text = '3' then
begin
with combobox2 do
begin
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
Add('Zone 3 depts');
end; {with combobox2}
end; {If }
if text = '4' then
begin
with ComboBox2 do
begin
add('Zone 4 depts');
add('Zone 4 depts');
add('Zone 4 depts');
add('Zone 4 depts');
add('Zone 4 depts)';
end;{combobox2 with}
end;{IF}
if text ='1' then
begin
with ComboBox2 do
begin
add('Zone 1 depts');
add('Zone 1 depts');
add('Zone 1 depts');
add('Zone 1 depts');
add('Zone 1 depts');
add('Zone 1 depts');
end; {combobox2 with}
end; {IF}
if text ='2' then
begin
with ComboBox2 do
begin
add('Zone 2 depts');
add('Zone 2 depts');
add('Zone 2 depts');
add('Zone 2 depts');
add('Zone 2 depts');
add('Zone 2 depts');
end; {Combobox2 with}
end; {IF}
if text ='BoneYard' then
begin
with ComboBox2 do
begin
add('BoneYard depts');
add('BoneYard depts');
add('BoneYard depts');
add('BoneYard depts');
add('BoneYard depts');
add('BoneYard depts');
end; {combobox2 with}
end; {IF}
if text = 'Misc' then
begin
with ComboBox2 do
begin
add('Misc Depts');
add('Misc Depts');
add('Misc Depts');
add('Misc Depts');
add('Misc Depts');
add('Misc Depts');
end; {combobox2 with}
end; {IF}
end;{combobox1 with}
Combobox2.Enabled := true;
end;
with
内部で別のものを使用できないことに気付きましたwith
..または私はそれを間違っています. 次に、もっと良い方法が必要だと思い始めました:Dだから、どちらの答えでも構いません。で修正する方法、またはこれをより良い方法で行う方法。