Autor Beitrag
dontello
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2



BeitragVerfasst: So 27.03.11 16:41 
Hallo,

hier mal mein Anliegen:

Der Benutzer gibt über eine Eingabemaske Daten ein, welche in Variablen gespeichert werden.
Nun möchte ich diese Daten in einer Tabellenzeile darstellen. Der Benutzer sollte die Möglichkeit haben über die Eingabemaske weitere Zeilen einzufügen.

Welche Komponente bietet sich für dieses Vorhaben an? Ich möchte eine Tabelle mit Spaltenüberschriften.
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: So 27.03.11 17:01 
Mit TStringGrid ist das möglich und wenn es auch gut aussehen und mehr Funktionen bieten soll, bieten sich die VirtualTrees an.
dontello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2



BeitragVerfasst: So 27.03.11 17:04 
Ja das TStringGrid hat mit optisch auch nicht so zugesagt optisch.

Gibt es denn eine Möglichkeit mit der TDBGrid zu arbeiten und diese mit Variablen zu füllen, oder geht das nur in Verbindung mit einer Datenbank?
ub60
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 765
Erhaltene Danke: 130



BeitragVerfasst: So 27.03.11 17:04 
TListView wurde auch gehen.

ub60
dontello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2



BeitragVerfasst: So 27.03.11 18:47 
Ich habe jetz im Listview drei Columns festgelegt. Wie kann ich dort meine Daten drunter einordnen zur jeweiligen spalte?
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: So 27.03.11 18:55 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  NewItem: TListItem;
begin
  NewItem := MyListView.Items.Add;
  NewItem.Caption := 'Erste Spalte';
  NewItem.SubItems.Add('Zweite Spalte');
  NewItem.SubItems.Add('Dritte Spalte');
Trotzdem rate ich eher zu den genanten VirtualTrees, weil die besser anpassbar sind und bei der Datenanbindung deutlich besser sind.
dontello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2



BeitragVerfasst: So 27.03.11 18:57 
Ist die Komponenete denn kostenpflichtig?
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: So 27.03.11 18:58 
Klick den Link doch einfach an... :roll:

Nein, ist sie nicht, die ist Open Source unter der MPL oder LGPL.
dontello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2



BeitragVerfasst: So 27.03.11 19:18 
ok hab mir das ganze mal installiert.

hast du denn evtl ein beispile für die erstellung einer solchen tabelle?
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: So 27.03.11 19:55 
Beispiele sind eigentlich dabei, oder?

Hier findest du ein Programm von mir, in dem ich die Komponente nutze:
www.delphi-forum.de/...=0&postorder=asc

Und ein kleines Beispiel liegt im Anhang.
Einloggen, um Attachments anzusehen!
dontello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2



BeitragVerfasst: Mo 28.03.11 00:15 
danke für dein beispiel.

ich habe die tvirtualtable komponente gefunden. Weißt du wie ich dort zur Laufzeit einen neuen Datensatz einfügen kann?
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: Mo 28.03.11 06:05 
Diese Datenbankkomponente kenne ich nicht. Aber da es ein TDataSet ist wird es wie jedes TDataSet funktionieren. Zuerst musst du (mit AddField vermutlich) die Felddefinitionen für die Datenbankfelder einfügen. Danach kannst du dann so etwas damit machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  MyVirtualTable.Append;
  MyVirtualTable.FieldByName('INDEX').AsInteger := 343;
  MyVirtualTable.FieldByName('ENTRYNAME').AsString := 'Wertname';
  MyVirtualTable.FieldByName('ENTRYVALUE').AsString := 'Wert';
  MyVirtualTable.Post;
Ich frage mich allerdings, ob du diese Komponente wirklich brauchst und ob dir klar ist wofür diese da ist. ;-)