Autor Beitrag
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Mi 09.06.04 20:42 
Hallo wie kann ich das machen das wenn ich in Listbox1 das 4 item ausgewählt habe
das bei listbox2 und 3 auch das 4 mackiert wird.

Danke

Gruß

Sauger Chris(Delphi7)


Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am So 13.06.2004 um 20:44
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Mi 09.06.04 20:54 
Hi,

meinst du jetzt Speziell für diesen Fall, oder generell???

ausblenden Quelltext
1:
2:
3:
4:
if ListBox1.ItemIndex = 3 then begin
  ListBox2.Selected[2]:=true;
  ListBox2.Selected[3]:=true;
end;


und MultiSelect natürlich bei der ListBox auf true setzen.

Ansonsten wenn es für mehrere fälle zutreffen soll, einfach mit case anstatt if ;)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 09.06.04 20:59 
Ich glaube, du meinst das:
ausblenden Delphi-Quelltext
1:
2:
ListBox2.ItemIndex:=ListBox1.ItemIndex;
ListBox3.ItemIndex:=ListBox1.ItemIndex;

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Mi 09.06.04 21:01 
Titel: listbox1, 2, 3
Ja Aya gut aber wie mache ich das dann wenn
ich über 1000 einträge habe.
listbox1.click

Danke

Gruß

Sauger Chris(Delphi7)
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 09.06.04 21:07 
In einer Suche in: Delphi-Forum, Delphi-Library SCHLEIFE.

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Do 10.06.04 14:49 
Titel: listbox1, 2, 3
Hallo ich habe selber einen code geschrieben. :D
ausblenden Delphi-Quelltext
1:
2:
3:
listbox2.Selected[listbox1.ItemIndex] := true;
listbox3.Selected[listbox1.ItemIndex] := true;
end;end;


Gruß

Sauger Chris(Delphi7)

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


Zuletzt bearbeitet von Sauger Chris am Do 10.06.04 15:12, insgesamt 1-mal bearbeitet
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 10.06.04 14:53 
:o :shock: damit machst du niks anderes als:

ausblenden Delphi-Quelltext
1:
2:
listbox2.Selected[listbox1.ItemIndex] := true; 
listbox3.Selected[listbox1.ItemIndex] := true;


:roll:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Do 10.06.04 14:59 
ja mehr wolte ich ja gar nicht :D
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 10.06.04 15:00 
Dann lass doch die beknackte Schleife weg!
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 10.06.04 15:08 
MathiasSimmack hat folgendes geschrieben:
Dann lass doch die beknackte Schleife weg!


sooooooo wollt ich das etz nicht sagen... :P

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Do 10.06.04 15:10 
ok ok die schleife ist schon weg

Gruß

Sauger Chris(Delphi7)
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Do 10.06.04 15:15 
Titel: Re: listbox1, 2, 3
Sauger Chris hat folgendes geschrieben:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.ListBox1Click(Sender: TObject);
var i : integer;
begin
for i := 0 to listbox1.Count-1 do
begin
listbox2.Selected[listbox1.ItemIndex] := true;
listbox3.Selected[listbox1.ItemIndex] := true;
end;end;


So richtig wird das nicht funktionieren. Außnahme ist, wenn ListBox2 und 3 die gleiche Menge an Items haben. Wenn nicht, dann bricht die Funktion mit einer Fehlermeldung ab. Besser ist eine Sicherheitsabfrage einbauen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.ListBox1Click(Sender: TObject);
var i : integer;
begin
  for i := 0 to listbox1.Count-1 do
    if listbox1.Selected[i] then
    begin
      if (listbox2.Count - 1) >= i then listbox2.Selected[i] := true;
      if (listbox3.Count - 1) >= i then listbox3.Selected[i] := true;
    end;
end;


Ist allerdings aus den Kopf und ungeprüft.

EDIT:

Auch wenn die Schleife nicht benötigt wird, so ändert es nichts an der Sicherheitsabfrage.

_________________
Gruß
Martin
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Do 10.06.04 15:21 
ja danke ich werde deinen code mal nacher testen

Gruß

Sauger Chris(Delphi7)
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 12.06.04 19:52 
nein nein nein!

er will nicht alle markieren, sondern das gleiche...

ausblenden Delphi-Quelltext
1:
2:
if (listbox2.Count - 1) >= listbox1.ItemINdex then listbox2.Selected[listBox1.ItemIndex] := true;  
if (listbox3.Count - 1) >= listbox1.ItemIndex then listbox3.Selected[listBox1.ItemIndex] := true;


das
:P

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)