Autor Beitrag
mikeyboy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 96

WIN XP
D6 Pers
BeitragVerfasst: Mo 03.01.05 09:47 
Hallo

ich steh momentan an und hoffe es nimmt sich wer die Zeit mir zu helfen!
Und zwar möchte ich bei einer bestimmten Auswahl in einer ComboBox z.B. Item Index 1 in einer anderen ComboBox Zeilen einfügen! Das hab ich zwar geschaftt aber nur ein Item, wenn´ich es nochmal schreibe mit der zweiten eingabe bekomm i Fehlermeldung zweimal das gleiche! Wie mach ich das, dass ich mehrere Items einfügen kann??
Das is mein Quelltext für diesen Teil oder muss ich das anders schreiben??
ausblenden Delphi-Quelltext
1:
2:
case CBAlter.ItemIndex of
0,1,2,3: CBAlter2.Items.Add('1')


Und noch eine Frage?! Wenn ich jetzt z.B. Item Index 1 auswähle, und danach Item Index 2 dann stehen von beiden Auswahlmöglichkeiten die Items in der ComboBox! Gibt es eine Möglichkeit die Item List löschen zu lassen bevor er neue Items hinzufügt??

Ich danke im vorraus

lg mike
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Mo 03.01.05 10:26 
Das hinzu fügen sieht schon richtig aus.
wie genau heisst den der fehler?!?
was hast du versucht nochmal zuschreiben..

zeig mal nen bisschen mehr code und markiere die stelle wo der fehler auftritt

Löschen der Combobox mit

ausblenden Delphi-Quelltext
1:
  MyCombobox.Clear;					
mikeyboy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 96

WIN XP
D6 Pers
BeitragVerfasst: Di 04.01.05 14:35 
Also das ist jetzt der ganze Quelltext! Markieren?? Kann i net! :oops:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
unit Fragebogen;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TForm1 = class(TForm)
    LabelFragebogen: TLabel;
    LabelEinleitung1: TLabel;
    LabelEinleitung2: TLabel;
    LabelEinleitung3: TLabel;
    ButtonJa: TBitBtn;
    ButtonNein: TBitBtn;
    LabelFrage1: TLabel;
    CBAlter: TComboBox;
    LabelSehr: TLabel;
    LabelMutig: TLabel;
    LabelA1: TLabel;
    CBGeschlecht: TComboBox;
    LabelA3: TLabel;
    LabelA2: TLabel;
    LabelA4: TLabel;
    LabelA5: TLabel;
    LabelA6: TLabel;
    CBAlter2: TComboBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    LabelFrage3: TLabel;
    LabelFrage2: TLabel;
    LabelFrage4: TLabel;
    LabelFrage5: TLabel;
    LabelFrage6: TLabel;
    ButtonEnde: TBitBtn;
    procedure ButtonNeinClick(Sender: TObject);
    procedure ButtonJaClick(Sender: TObject);
    procedure CBAlterChange(Sender: TObject);
    procedure CBGeschlechtChange(Sender: TObject);
    procedure ButtonEndeClick(Sender: TObject);


  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ButtonNeinClick(Sender: TObject);
begin
Form1.Close

end;

procedure TForm1.ButtonJaClick(Sender: TObject);
begin
ButtonJa.Visible := False  ;
ButtonNein.Visible := False  ;
ButtonEnde.Visible := true   ;
LabelFrage1.Visible := true  ;
CBAlter.Visible := true  ;
LabelSehr.Visible := true  ;
LabelMutig.Visible := true 

end;

procedure TForm1.CBAlterChange(Sender: TObject);
begin
LabelFrage2.Visible := true  ;
CBAlter2.Visible := true ;
LabelA1.Visible := true ;
case CBAlter.ItemIndex of
0,1,2,3: CBAlter2.Items.Add('1') ;         <span style="color: green">\\da hats was!!</span>
0,1,2,3: CBAlter2.Items.Add('2') ;         <span style="color: green">\\Fehlermeldung:</span>
0,1,2,3: CBAlter2.Items.Add('3') ;         <span style="color: green">\\Doppeltes Case Label</span> 0,1,2,3: CBAlter2.Items.Add('4') ;                      


end;

case CBAlter.ItemIndex of
0,1,2,3: LabelA1.Caption:='BABY' ;
4,5,6: LabelA1.Caption:='WERD ENDLICH MAL ERWACHSEN' ;
7,8,9: LabelA1.Caption:='ZIEMLICH UNWARHSCHEINLICH' ;
10: LabelA1.Caption:='GLAUB ICH NICHT' ;
end;

end;

procedure TForm1.CBGeschlechtChange(Sender: TObject);
begin
LabelA3.Visible := true ;
LabelFrage4.Visible := true ;
case CBGeschlecht.ItemIndex of
0:LabelA2.Caption:='FEIG'  ;
1:LabelA2.Caption:='SCHÖN FÜR DICH'    ;
2:LabelA2.Caption:='O GOTT DAS AUCH NOCH'   ;

end;


end;

procedure TForm1.ButtonEndeClick(Sender: TObject);
begin
Form1.close
end;

end.



Danke das min löschen klappt mal :)
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Di 04.01.05 15:04 
deine Case anweisung ist falsch gewesen.
du kannst einen index nicht mehrfach angeben.

probiers mal mit der funktion.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.CBAlterChange(Sender: TObject);  
begin  
LabelFrage2.Visible := true  ;  
CBAlter2.Visible := true ;  
LabelA1.Visible := true ;  
case CBAlter.ItemIndex of  
0: CBAlter2.Items.Add('1') ;   //wenn 0 dann '1' hinzufügen
1: CBAlter2.Items.Add('2') ;   // ... 1 ...  '2' ..
2: CBAlter2.Items.Add('3') ;   //usw..
3: CBAlter2.Items.Add('4') ; 
end;
mikeyboy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 96

WIN XP
D6 Pers
BeitragVerfasst: Di 04.01.05 15:13 
Ja das ist mir klar, aber ich brauch eben etwas wo ich beim ItemIndex 0,1,2,3 der ComboBox1, Items in die ComboBox2 schreibe und zwar MEHRERE bei einem ItemIndex nur weiß i net wie, wenn i , mach und z.B. ('2') gehts a net! Wie mach ich das, dass ich mehrere Einträge in die Itemlist schreiben will bei einem ITEMINDEX :?: :?: :?:



danke im vorraus
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Di 04.01.05 15:21 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.CBAlterChange(Sender: TObject);    
begin    
  LabelFrage2.Visible := true  ;    
  CBAlter2.Visible := true ;    
  LabelA1.Visible := true ;    
  case CBAlter.ItemIndex of    
  0,1,2,3: 
   begin
     CBAlter2.Items.Add('1') ;
     CBAlter2.Items.Add('2') ;
     CBAlter2.Items.Add('3') ;
     CBAlter2.Items.Add('4') ;   
   end;
  4,5,6:
    begin
     CBAlter2.Items.Add('irgendetwas') ;
     CBAlter2.Items.Add('anderes') ;
    end;
  end;


alle vier einträge werden bei den indizes 0 bis 3 hinzugefügt
2 andere einträge werden hinzugefügt wenn der index 4 bis 6 ist

@mikeyboy: kannst du bitte das bayrisch weglassen ...
mikeyboy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 96

WIN XP
D6 Pers
BeitragVerfasst: Di 04.01.05 15:32 
Ich danke dir!

Noch 2 Fragen??

1) Was meinst du damit? kannst du bitte das bayrisch weglassen??

*) Ich bin aus Österreich nur so zur INFO!!

2) Wie hast du das gemacht, dass du im Quelltext grün schreibst??


lg mike
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Di 04.01.05 15:44 
1.
dieses "i" is grausig. und ob nu bayern oder österreich ist eigentlich egal ich wohn an der küste und die richtung stimmte ja.

2.
kommentare werden in dalphitags grün dargestellt
d.h. alles was zwischen { und } steht bzw was hinter // bis zum zweilen ende steht ist ein kommentar im delphisysntax und wird entsprechend grün dargestellt.