Autor Beitrag
christoph
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

Win XP(SPack1),Win 2000(Spack3)
Delphi 6(Spack2)
BeitragVerfasst: Fr 16.05.03 19:20 
Hallo....

Ich benutze folgenden Code um Items von eienr Listbox zur anderen zu kopieren nur die Abfrage wenn Item vorhanden dann nicht einfügen klappt nicht...

Hier mein Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure ListDragDrop(Sender, Source: TObject; X, Y: Integer);
var
i : integer;
s : string;
point : TPoint;
begin
point.X := x;
point.Y := y;
if (Sender is TListBox) and (Source is TListbox) then
      with Sender as TListBox do
      for i := 0 to (Source as TListbox).Items.Count -1 do
      if  (Source as TListbox).Selected[i]= true then begin
           s :=(Source as TListbox).Items[i];
      If Items.IndexOf(s)=-1 then
      If ItemAtPos (Point,true)>=0 then 
          Items.Insert((source as TListbox).ItemAtPos(point,true),s)
      else
          Items.Add(s);
     end;
end;

versuche ich nach dem start meines Programms items hinzuzufügen die schon da sind klappt es

adde ich aber ein item was nicht schon da ist danach klappt die function nicht mehr !!!!

Gruss
Chris
christoph Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

Win XP(SPack1),Win 2000(Spack3)
Delphi 6(Spack2)
BeitragVerfasst: Fr 16.05.03 23:02 
Fehler schon gefunden....da in meinen Items auch der ItemCount drin war
musste der Vegleich ja immer grösser -1 sein

Gruss
Chris