Autor Beitrag
rafi@work
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Di 01.07.03 12:37 
nun muss ich das ganze umgekehrt machen, hat jemand eine Idee wie ich das machen kann? Also die ganze ListView in der ini speichern?

danke für eure Hilfe!

Moderiert von user profile iconTino: Titel geändert & Topic verschoben.
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Di 01.07.03 13:58 
Du arbeitest alle Einträge der Zeile lang druch und vergiebst für jede Zeile eine sektion.
Pro Zeile (Sektion) legtst du zuerst eine Variable an, die die Anzahl der vorhandenen Spalten angiebt und dann jeweils für jede Spalte eine Variable.

Beipsiel

ini hat folgendes geschrieben:

[zeile0]
anzahl=3
spalte0=TEXT
spalte1=TEXT
spalte2=TEXT
[zeile1]
anzahl=3
spalte0=TEXT
spalte1=TEXT
spalte2=TEXT
...

Das mit der anzhal kann man natürlich auch in eine Packen, also eine Infosparte. Das würde dann so aussehen:
ini2 hat folgendes geschrieben:

[info]
programm=Programm aus dem es kommt
version=Version des Programms
spaltenzahl=3
exportdate=01.07.2003
[zeile0]
spalte0=TEXT
spalte1=TEXT
spalte2=TEXT
[zeile1]
spalte0=TEXT
spalte1=TEXT
spalte2=TEXT
...
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Di 01.07.03 14:26 
danke für deine Hilfe Onz! Könntest du mir nicht ein Code Beispiel geben, ich bin noch sehr unerfahren in Delphi. Ich wäre dir sehr dankbar, das Programm sollte morgen fertig sein... :(

gruss
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Di 01.07.03 14:35 
Ok

Der Code ist nicht überprüft, ok?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
uses IniFiles;

procedure ListViewToIni(Liste: TListeView; IniDir: Filename);
var Ini: TInifile;
      I,B: Integer;
begin
  Ini:=TIniFile.create(IniDir);
  Ini.WriteInteger('info','anzahl',Liste.Columns.count-1);
  for i:=0 to Liste.Items.Count-1 do
  begin
    for b:=0 to Liste.Columns.Count-1 do
    begin
      if b=0 then
        Ini.WriteString('zeile'+inttostr(i),'spalte'+inttostr(b),Liste.Items[i].caption)
      else
        Ini.WriteString('zeile'+inttostr(i),'spalte'+inttostr(b),Liste.Items[i].SubItems[b-1]); 
    end;
  end;
  ini.free;
end;

Anwendung:
ListViewToIni(ListeView,'C:\test.ini');


Ich hoffe das hilft dir.
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Di 01.07.03 15:21 
danke klappt bestens!
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Di 01.07.03 15:24 
Freut mich. :D
XmasKeX
Hält's aus hier
Beiträge: 13

WinXP Pro, Win2000 Pro, SuSE 9.0
D7 Prof, D6 Pers
BeitragVerfasst: Fr 20.02.04 21:24 
Titel: Häh
Hallo, hab das eben auch probiert und ich hab ein Problem. Was muss ich bei Filename hinschreiebn? Da kommt immer ein Fehler.

Danke
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 21.02.04 08:49 
Ist ein bisschen schwer zu sehen, weil Onz das bloß angehangen hat:
Onz hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
{ ... }

ListViewToIni(ListeView,'C:\test.ini');


Und du sagst zwar nicht, welcher Fehler auftritt, aber ich schätze mal, der hat nichts mit dem Dateinamen zu tun sondern mit dem E in TListeView:
Zitat:
ausblenden Delphi-Quelltext
1:
procedure ListViewToIni(Liste: TListeView; IniDir: Filename);					

Nimm´s raus, dann sollte es erst mal gehen. ;)
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Sa 21.02.04 09:22 
Und du sagst zwar nicht, welcher Fehler auftritt, aber ich schätze mal, der hat nichts mit dem Dateinamen zu tun sondern mit dem E in TListeView:

Uaaaa :) Sorry :oops:

So ein Mist, ein TListeView ;)

Gruß
Steven
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Mi 26.05.04 11:44 
Hallo....
wer mag mir sagen wie ich die listview wieder aus einer inidatei laden/füllen kann?

grüße
steven
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Mi 26.05.04 13:58 
Hallo

Du musst dir obrige Prozedur einfach umkehren.

Gruß
Steven
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Mi 26.05.04 15:39 
das sagst du so einfach...mal sehen :)