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



BeitragVerfasst: Mi 15.12.04 18:48 
So hab mal einen neuen Thread gemacht.

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;



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
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mi 15.12.04 19:37 
Hi
dann solltest du das mal so probieren

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

begin
for a:=0 to FileListBox1.Items.Count-1 do begin
  if FileListBox1.Selected[a] then begin
     b :=FileListBox1.Items[a];
     for c:=0 to FileListBox2.Items.Count-1 do
         if  FileListBox2.Selected[c] then begin
             d := FileListBox2.Items[c];
             Memo1.Lines.Add('copy '+b+' '+d);
         end;
   end;
end;

end;




Ein bisschen rumexperimentieren mit dem Debugger hätte dich sicher auch drauf gebracht. :mrgreen: In dieser Form hast du allerdings noch ein problem wenn in der ersten Liste 1 Eintrag und in der zweiten Liste mehrere Einträge markiert sind. Das kannst du aber selber austüfteln. :wink:

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Newhack Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 16.12.04 14:54 
hey danke es geht :D