Autor Beitrag
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Mo 03.09.07 18:22 
Hallo,

Ich benutze zum speichern-lassen von Dateien den SaveDialog...
Aber wenn ich bei der OnSelectionChange-Routine den FileName auslese, bekomme ich nicht den eingegebenen Dateinamen...
Wie kriege ich auch den?


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 03.09.2007 um 21:09
fuba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Win7
D7 Ent.
BeitragVerfasst: Mo 03.09.07 18:58 
also mal ehrlich, deine frage verwirrt mich ein wenig :D

aber ich kann mir denken was du suchst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
  begin
    if SaveDialog1.FileName <> '' then
    begin
      Memo1.Lines.SaveToFile(SaveDialog1.FileName);    
    end;
  end;
end;


und dies steht nicht im "OnSelectionChange" von SaveDialog1!
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Mo 03.09.07 19:20 
ah... jetzt klappts...
Also:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure Button1Click(Sender: TObject);
var filename: String;
begin
  if SaveDialog1.Execute then
  begin
    filename := SaveDialog1.FileName;
  end;
end;

Zumindest klappt es so bei mir...
fuba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Win7
D7 Ent.
BeitragVerfasst: Mo 03.09.07 20:13 
hmm, das versteh ich aber jetzt nicht...

ich dachte du willst mit dem SaveDialog eine datei speichern ?!?

filename := SaveDialog1.FileName;

versteh ich nicht, da jedes mal wenn du einen anderen Dateinamen im SaveDialog eingibst, dann ändert der sich auch.

Bzw, welche aufgabe hat "filename" bei der procedure jetzt?
weil für mich sieht das aus, als würdest du eine Datei LADEN nicht SPEICHER ^_^
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 03.09.07 20:25 
Der Dialog selber speichert nicht, sondern kapselt nur die Dateiauswahl. Anschließend befindet sich der Dateiname/Pfad in .FileName

_________________
Markus Kinzler.
fuba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Win7
D7 Ent.
BeitragVerfasst: Mo 03.09.07 21:03 
jo dachte ich mir schon :D

Dann nimm aber bitte den "OpenDialog" der kommt da besser als der "SaveDialog" ;)
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Di 04.09.07 14:03 
Aber ich will doch speichern...
Deshalb SaveDialog...
Ich hab das Speichern jetzt weggelassen, weil das etwas längerer Code ist (in meinem Programm)