Autor Beitrag
steve-allround
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Fr 04.11.05 14:54 
Hallo,

ich muss in meinem Programm unbedingt eine Auswahlliste hinzufügen. Da war für mich die ComboBoxEx am besten. Ich habe nun 4 Items erstellt mit 0, 1, 2 und 3.
Nun soll, wenn z.B.: ich eins davon anklicke oder auswähle eine Funktion ausgeführt werden.
Z.B. Close;
o.ä....

Kann mir das jemand helfen, denn eineige Codes sind relativ lang und beginnen mit var, begin und end;...

Ich habe beim vielen Suchen auch bei Google kein Ergebnis gefunden....
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 04.11.05 15:25 
Gruss !

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.ComboBoxEx1Click(Sender: TObject);
begin
  if ComboBoxEx1.ItemIndex = 0 then Close;
  if ComboBoxEx1.ItemIndex = 1 then Tu Was;
end;
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Fr 04.11.05 15:39 
IMHO wär hier eine case Abfrage effizienter o. zumindest übersichtlicher:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
case ComboBox.ItemIndex of
 0: Close;
 1: Mach was;
end;


mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
steve-allround Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Fr 04.11.05 20:45 
echt vielen Dank, ich probiere es gleich mal aus.
steve-allround Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Sa 05.11.05 11:31 
mh, ich es ausprobiert, das Problem ist nur, dass ich es nur einmal nutzen kann.
Ich habe aber ja 4 Funktionen in meiner Box, die ich stöndig nutzen will. Also klick 1 Funktion 1 u.s.w.... Ich möchte immer zwischen den Funktionen hin und her springen....
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 05.11.05 14:48 
Wo liegt jetzt das Problem if 0 Tu dies if 1 Tu das !?