Autor Beitrag
T.E.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

Win RT, Win 7 Pro, Win 8 Pro
Delphi 2009 Enterprise, Delphi XE, Delphi XE2
BeitragVerfasst: Fr 24.09.10 09:55 
Moin moin,

ich habe grad ein Problem mit einer ListView aus der ich die Captions der markierten Zeilen in eine Listbox eintragen möchte und dort halt um einen String ergänze...

Wenn ich folgenden Code verwende gibt es eine Zugriffsverletzung die in wohl in der letzten Zeile liegt, denn wenn ich dort einfach das
Zitat:
+ Filelist_Grid_SchnittFertig.Selected.Caption

entferne klappt es zumindest das die richtige Anzahl an Strings erzeugt wird.

ListView = Filelist_Fertig
ListBox = Listbox_normal_quue_st1

Inhalt/Aufbau der ListView:
ausblenden Quelltext
1:
2:
Caption - Column1 - Column2
Name    - Datum   - Menge


ausblenden Delphi-Quelltext
1:
2:
3:
4:
with Filelist_Fertig do
  for i := 0 to Items.Count - 1 do
    if Items[i].Selected then                    
      Listbox_normal_quue_st1.items.add('fertig/' + Filelist_Fertig.Selected.Caption);


Und ich komm da leider nicht weiter...
Woran liegt das bzw. wie kann ich meinen Fehler beheben?

_________________
Schöne Grüße,
Torben
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 24.09.10 09:59 
Probier das mal so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
with Filelist_Fertig do
  for i := 0 to Items.Count - 1 do
    if Items[i].Selected then                    
      Listbox_normal_quue_st1.items.add('fertig/' + items[i].Caption);

Die Eigenschaft Selected der Listview (ist das ein Item?) ist bei MultiSelect ja auch überhaupt nicht sinnvoll - könnte sein, dass das dann auch immer Nil ist. ;-)

_________________
We are, we were and will not be.
T.E. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

Win RT, Win 7 Pro, Win 8 Pro
Delphi 2009 Enterprise, Delphi XE, Delphi XE2
BeitragVerfasst: Fr 24.09.10 10:04 
Autsch...!

stimmt hast Recht und das hat dann auch geklappt :) Danke!

_________________
Schöne Grüße,
Torben