Autor Beitrag
danielpt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81

Windows 2000 Professional SP4
D6 Personal
BeitragVerfasst: Do 07.08.03 12:14 
Hallo!
Ich habe vor ca. 5 Tagen mit der Programmierung in Delphi angefangen, d.h. bin ein TOTALER ANFÄNGER... ;)

Meine Frage: Wie kann ich bei meinem RTF-Editor einbauen, dass er den Benutzer fragt, ob er das noch nicht gespeicherte Dokument jetzt sichern möchte? (beim Beenden des Progs...)

thx

_________________
cu daniel
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 07.08.03 12:35 
hallo,

in deinem Formular gibt es ein Event OnClose

Dort fügst du folgenden Code ein

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  if messageDlg('Soll das Dokument jetzt gespeichert werden?',
      mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
    if opendialog1.execute then 
       richedit1.lines.savetofile(opendialog1.file);
  end;


Bin mir nicht ganz sicher, ob es file oder filename heißt.


Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
danielpt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81

Windows 2000 Professional SP4
D6 Personal
BeitragVerfasst: Do 07.08.03 12:44 
nein, "onClose" gibts leider nicht... :(

(oder ich bin zu dumm das zu finden... :D)

_________________
cu daniel
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Do 07.08.03 12:47 
Hi,
du musst im Object inspector auf Events klicken, das sthet ganz oben auf so einnen Reiter. Dann siehst du eine neue List und dort steht onclose.

Greetz
danielpt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81

Windows 2000 Professional SP4
D6 Personal
BeitragVerfasst: Do 07.08.03 12:50 
hallo @onlinehome, schon lange nichts mehr von einander gehört... :D

Danke, jetzt wo dus sagst... :oops:

_________________
cu daniel
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Do 07.08.03 12:51 
Gern..... :think:
danielpt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81

Windows 2000 Professional SP4
D6 Personal
BeitragVerfasst: Do 07.08.03 14:31 
ähhm, ich hab jetzt nur ein paar Probleme:

1. Der Dialog heißt "öffnen"!
2. Die Ende ".rtf" wird nicht hinzugefügt.

help please!

_________________
cu daniel
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Do 07.08.03 14:52 
Hi,

den Titel des Öffnen/Speichern Dialogs kannst du ändern, indem du im ObjectInspector einfach was bei "Title" angibst ;)

Die Dateinamenerweiterung mußt du selber hinzufügen, z.B. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  S: String;
begin
  if SaveDialog.Execute then begin
    S:=SaveDialog.FileName;
    if Pos('.rtf',S)=0 then
      S:=S+'.rtf';
  end;
end;


Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 07.08.03 16:24 
Aya hat folgendes geschrieben:
Hi,

den Titel des Öffnen/Speichern Dialogs kannst du ändern, indem du im ObjectInspector einfach was bei "Title" angibst ;)



Oder, man nimmt einen SaveDialog *G* War mein Fehler in meinem Beispiel. :wink:

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
recall
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 11.08.03 00:43 
Hallo,

Es gibt eine sogennante "Standarderweiterung".
Die findet sich im ObjectInspector als: DefaultExt
Dort einfach *.rtf eintragen, fertig !

P.S.:

Zitat:
if Durst then begin Beer.getFromKuehlschrank(); ReturnToCouch(); end;

...ist nicht benutzerfreundlich, was wenn ein FEHLER auftritt ???
Also:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
if Durst then
begin
  try
    Beer.getFromKuehlschrank();
    ReturnToCouch();
  expect
    on KuehlschrankEmpty do
      SendMessage('Frau', 'Hol mal Bier!', 0);
  end;
  DrinkBeer();
end;
danielpt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81

Windows 2000 Professional SP4
D6 Personal
BeitragVerfasst: Mo 11.08.03 07:12 
;) :D ob das delphi gut findet... ;)

_________________
cu daniel