Autor Beitrag
Nachtschrat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Sa 09.02.08 15:58 
Tach zusammen,
ich verzweifle gerade an meinem ListView. Ich will den Inhalt von zwei TEdits auslesen und an die ListView weitergeben. Also per Buttonklck sollen beide bestehenden TListColumns gefüllt werden. ViewStyle steht auf vsReport. In die erste Column bekomme ich was rein aber in die zweite nicht. Ich habe schon viel probiert aber irgendwie bekomme ich die zweite Column nicht voll.

Danke fürs lesen und die evtlle Hilfe :)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 09.02.08 16:10 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
with ListView1.Items.Add do
begin
  Caption := 'Test';
  SubItems.Add('A');
  SubItems.Add('B');
end;
Du kannst natürlich auch eine Variable statt with benutzen.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Sa 09.02.08 16:11 
Hallo

was hast Du denn bis jetzt?

listitem.caption ist die erste Spalte, die restlichen Spalten erreichtst du über subitems (zum hinzufügen
ausblenden Delphi-Quelltext
1:
listitem.subitems.add('bla');					


Gruß Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Sa 09.02.08 16:24 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  ListItem: TListItem;
begin
    with ListView1 do
    begin
        ListItem := Items.Add;
        ListItem.Caption := 'Text';
        ListItem.SubItems.Add('Zweiter Text');
      end;
    end;
end;

_________________
Popov
Nachtschrat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Sa 09.02.08 16:38 
Ahc du Schreck, ich bin die Sache ganz falsch angegangen :). Mit SubItem habe ich noch gar nicht herumexperimentiert. Habe mir im SourceCode meine Lösungen 'erarbeitet'. Es wird ja doch einiges angewgeben an Vorschlägen. Die Hilfe hat mir auch nicht weiter geholfen. Am Schluss bin ich bei 'ListView1.Items.AddItem('hello',)' gelandet und wusste nicht was ich hinters komma schreiben soll.
Naja, vielen Dank soweit!