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:
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