Autor Beitrag
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Mi 15.12.04 18:17 
hallo
hab mal eine kleine Frage:

Mein Source:

ausblenden Quelltext
1:
memo1.Lines.add(FileListBox1.items.text);					


wie mach ich es das nicht alle Datein in das Memo geschrieben werden die in der Listox dargestellt sind sondern nur meine ausgewählten??

Danke
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Mi 15.12.04 18:28 
ausblenden Delphi-Quelltext
1:
2:
for a:=0 to ListBox.Items.Count-1 do
  if ListBox.Selected[a] then Memo.Lines.Add(ListBox.Items[a]);

Zum Beispiel ...

Gruß,
Jörg

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
Loki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34

Win XP Home

BeitragVerfasst: Mi 15.12.04 18:29 
Ist nicht getestet aber so müsste es gehen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
begin
  for i := 0 to ListBox1.Items.Count -1 do
  begin
    if ListBox1.Selected[i] then
      Memo1.Lines.Add(Listbox1.Items.Strings[i];
  end;
end;


MFG

Loki

//Edit: Zu langsam :D
Newhack Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Mi 15.12.04 18:31 
Danke gehen beide da es ja gleiche sind :D

Hab jetzt noch ein Prob. Ich habe 2 FileListbox. Und die File aus listbox1 soll das file aus listbox2 kopieren.

Also soll dan in der memo so stehen:
copy 'file aus listbox1' 'file aus listbox2'

Wie soll ich das da machen?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 15.12.04 18:35 
Neue Frage :arrow: Neuer Thread :-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Newhack Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Mi 15.12.04 18:43 
och bidde :roll:

Hier ich habe mal das Versucht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);
 var
 a,c:integer;
 b,d:string;

begin
for a:=0 to FileListBox1.Items.Count-1 do
  if FileListBox1.Selected[a] then b :=FileListBox1.Items[a];
for c:=0 to FileListBox2.Items.Count-1 do
  if FileListBox2.Selected[c] then d := FileListBox2.Items[c];

Memo1.Lines.Add('copy '+b+' '+d);

end;


Das geht aber.

Wenn ich z.b. in der listbox1 2 files auswähle und in der listbox2 1 file auswähle kopiert er nur ein file nicht 2.

Also Listbox1: file1 / file2 / file3
ich habe file 1 und 2 markiert
in der listbox2: file5
da hab ich das eine file kopiert

nun möchte ich das es in der memo so aussieht:
copy file1 file5
copy file2 file5


hoffe ihr habt es verstanden

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 15.12.04 18:45 
Newhack hat folgendes geschrieben:
och bidde :roll:
Nix da! Ich finde es ziemlich frech, trotzdem noch weiter zu machen! :evil:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.