Autor Beitrag
Nero
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Mo 21.07.03 12:27 
Kann man wenn mehrere ComboBoxen die gleiche funktion erfüllen sollen
z.B ComboBox 1 bis ComboBox8, oder geht es nur so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
ComboBox1.Style:=csDropDownList;
ComboBox2.Style:=csDropDownList;
ComboBox3.Style:=csDropDownList;
ComboBox4.Style:=csDropDownList;
ComboBox5.Style:=csDropDownList;
ComboBox6.Style:=csDropDownList;
ComboBox7.Style:=csDropDownList;
ComboBox8.Style:=csDropDownList;


Gruß an alle

Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt.

_________________
Das schlimmste für einen Progger ist Sonnenschein und dieses fürchterliche Vogelgzwitscher
kat1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 40

Win XP
D6 EntPr
BeitragVerfasst: Mo 21.07.03 12:45 
Pack sie doch in ein array und danach alles in eine Schleife.

_________________
Mfg Uwe
Es ist eine Unsitte der Menschen, sich an alles zu gewöhnen.
Tana´Ri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 230



BeitragVerfasst: Mo 21.07.03 12:46 
also wenn du es zur laufzeit nicht ändern möchtest bzw. diese fest integriert sind, würde ich mir die mühe machen und im Objectinspector jene auf csDropdownlist zu setzen, dies spart unnötigen Code.

ansonsten könnte es über den Owner reguliert werden
(hier Standard TForm als Owner)

ausblenden Quelltext
1:
2:
3:
for i:=0 to Form1.ComponentCount-1 do
     if Form1.Components[i] is TComboBox then
        (Form1.Components[i] as TComboBox).Style := csDropDownList;

_________________
mfg
Tana´Ri
Nero Threadstarter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Mo 21.07.03 12:54 
Wahnsinn, das die Anworten hier so schnell kommen.
Habe es aber auch schon hinbekommen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm2.FormCreate(Sender: TObject);
var
  i:integer;
begin
for  i:=1 to  5 do
begin
(findcomponent('ComboBox'+inttostr(i)) as TComboBox).Style := csDropDownList;
end;


Trotzdem herzlichen Dank

Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt.

_________________
Das schlimmste für einen Progger ist Sonnenschein und dieses fürchterliche Vogelgzwitscher