Autor Beitrag
Stread
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 188

Win 7
Delphi XE
BeitragVerfasst: So 18.07.10 22:30 
Hi,

ich habe auf meinem Formular ein Paar Editfelder, Checkboxen und Radiobuttons.
Nun möchte ich gerne den Inhalt der Editfelder speichern und ob und wenn ja welche Checkboxen und Radiobuttons markiert sind. Das ganze soll auch wieder eingelesen werden.

Ich habe bis jetzt:
ausblenden Delphi-Quelltext
1:
Memo1.Lines.SaveToFile(ExtractFilePath(ParamStr( 0 )) + 'Lines.txt');					

Aber das speichert ja nur das Memo. Ich könnte jetzt ein unsichtbares Memo nehmen und dann alles reinspeichern, aber beim wieder einlesen könnte es Probleme geben.

Es gibt doch bestimmt noch eine schönere Variante oder?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 18.07.10 22:36 
Moin!

user profile iconStread hat folgendes geschrieben Zum zitierten Posting springen:
Es gibt doch bestimmt noch eine schönere Variante oder?
Ja, INI-Dateien, dafür sind sie gemacht. ;) Suche in: Delphi-Forum, Delphi-Library TINIFILE :lupe: :les: :think:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Stread Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 188

Win 7
Delphi XE
BeitragVerfasst: So 18.07.10 23:23 
Hast du noch einen Tipp wie ich in die INI schreiben kann welche Checkbox markiert ist und wie ich es beim einlesen wieder markieren kann?
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: So 18.07.10 23:45 
Das fällt mir so ein als Beispiel:
ausblenden Delphi-Quelltext
1:
myini.WriteBool('CheckBoxen''name der box oder nummer', CheckBox1.Checked);					

An der Stelle 'name der box oder nummer' kannst du auch den Componenten Namen direkt eingeben lassen über FindComponent. Kommt natürlich darauf an wieviele es davon gibt, ob es sich also lohnt das zu Automatisieren.

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!


Zuletzt bearbeitet von ALF am So 18.07.10 23:45, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 18.07.10 23:45 
Moin!

Speichern:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  var
    IniFile: TIniFile;
begin
  IniFile.WriteBool('Options','CheckBox1',CheckBox1.Checked);


Laden:
ausblenden Delphi-Quelltext
1:
  CheckBox1.Checked := IniFile.ReadBool('Options','CheckBox1',CheckBox1.Checked);					
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Stread Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 188

Win 7
Delphi XE
BeitragVerfasst: Di 20.07.10 18:50 
Danke, hat geklappt.

Wie kann ich denn diesen Save Dialog zum speichern verwenden? Er sagt mir: Inkompatible Daten.