Autor Beitrag
Kurdt67
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP
D7 Pers
BeitragVerfasst: So 18.09.05 09:40 
Hi! Ich hab Schwierigkeit mit einer ComboBox. Ich habe 2 ComboBoxen, die ComboBox2 ist am anfang auf visible=FALSE gesetzt. Die Box1 hat am Anfang visible=true und man kann 3 verschiedene Sachen auswählen. Nun will ich erreichen wenn
eine der 3 bestimmten sachen ausgewählt wurde die CheckBox2 erscheint. Das kriege ich noch hin.
IF ComboBox1.Text='...Muster...' THEN begin ComboBox2.visible=TRUE;
Mein problem ist jetzt folgendes. Wenn er das ausgewählt hat soll die ComboBox2 auch mit Strings belegt werden. Also da sollen dann auch bestimmt sachen drin stehen. Vielleicht 4 Auswahlmöglichkeiten. Wie kann ich ihn das zuweisen?
Bei der ComboBox1 hab ich das im Objektinspektor bei der Eigenschaft ITEMS gemacht! Wie mache ich das im Quelltext?

DANKE für eure Hilfe!
matze.de
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 576

Win95, Win98 SE, WinXp Prof SP2
D7P, D8P, FPC2.0
BeitragVerfasst: So 18.09.05 09:47 
Guck dir mal das Event OnChange an bei der ComboBox.

mfg matze

//Edit: Hatte das Problem anders aufgefasst, sollte morgens vllt mal genauer lesen ;D

_________________
si tacuisses, philosophus mansisses.


Zuletzt bearbeitet von matze.de am So 18.09.05 09:57, insgesamt 4-mal bearbeitet
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 18.09.05 09:47 
Auch über Items:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  i: Integer;

{..}

ComboBox2.Items.Clear; //ComboBox2 löschen falls notwendig
for i := 0 to ComboBox1.Items.Count - 1 do //Items übernehmen
  ComboBox2.Items.Add(ComboBox1.Items[i]);
ComboBox2.Visible := true; //ComboBox2 sichtbar machen.


Alles klar ;)?

AXMD
Kurdt67 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP
D7 Pers
BeitragVerfasst: So 18.09.05 10:07 
aber dann würde er doch die dinger aus der Box1 nur übernehmen sehe ich das richtig?
Wie kann ich da aber neue strings reinhauen??
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 18.09.05 10:09 
ausblenden Delphi-Quelltext
1:
ComboBox2.Items.Add('Mal was neues');					

_________________
We are, we were and will not be.
Kurdt67 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP
D7 Pers
BeitragVerfasst: So 18.09.05 10:29 
Oh danke, das geht also doch wie bei der LisBox mit items.add. Na da hätte ich ja auch mal
gleich drauf kommen können.
Noch ne Frage : Ich will ja immer bestimmte Dinge einleiten wenn eine Auswahl in der ComboBox
selektiert ist! Das habe ich jetzt immer so geschrieben :
IF ComboBox1.Text='Muster' THEN begin // Macht man das so? Ist das so gut,
oder geht das auch über SELECT oder so!??
DANKE!

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 18.09.05 10:37 
Hallo,

du könntest auch case dafür verwenden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
case ComboBox1.ItemIndex of
 0 : showmessage('Tu dies');
 1 : showmessage('oder das');
 2 : showmessage('sonst das');
end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Grishnak
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 221

Windows XP Home
Delphi 7 PE, Delphi 2005 PE
BeitragVerfasst: So 18.09.05 10:41 
Kurdt67 hat folgendes geschrieben:
Oh danke, das geht also doch wie bei der LisBox mit items.add. Na da hätte ich ja auch mal
gleich drauf kommen können.

Die Delphi-Hilfe (über [F1]) erweist sich auch oft als sehr hilfreich!

Kurdt67 hat folgendes geschrieben:
wenn eine Auswahl in der ComboBox selektiert ist

Wenn die ComboBox eine feste Auswahl hat (über .Style:=csDropDownList im Objekt-Inspektor), kannst du auch .ItemIndex abfragen!

_________________
Mach' etwas idiotensicher und irgendjemand erfindet einen besseren Idioten!
Kurdt67 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP
D7 Pers
BeitragVerfasst: So 18.09.05 12:10 
danke euch für eure hilf. brauche noch einen tip : passt hier aber nicht rein// also ich hab ne menge text in eine listbox zu hauen. ich will das der das alles ordentlich anzeigt. also sprich nen zeilenumbruch immer automatisch gemacht wird. geht das?? er darf aber auch die wörter nicht trennen.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 18.09.05 12:15 
Hallo,
wie Du schon richtig bemerkt hast:
user profile iconKurdt67 hat folgendes geschrieben:
...brauche noch einen tip : passt hier aber nicht rein...

:arrow: neue Frage :arrow: neues Thema :wink:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )