I
ilovedelphi3
Unregistered / Unconfirmed
GUEST, unregistred user!
我在做一个简易的文本编辑器,下面的代码是新建,
但如何在我按窗口右上角的大叉关闭按钮时候,能够提醒
用户并让打开的多个编辑区一一保存?
我做了很多办法都不行!特地来请教!谢谢您的帮助!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
PageControl1: TPageControl;
procedure Button1Click(Sender: TObject);
private
procedure NewRichEditSetup(NewRE: TRichEdit);
{ Private declarations }
public
NewTabSheet:TTabSheet;
NewRichEdit:TRichedit;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
NewTabSheet := TTabSheet.Create(PageControl1);
NewTabSheet.CAPTION := '未命名文档';
NewTabSheet.Hint := '未命名文档';
NewTabSheet.PageControl := PageControl1;
PageControl1.ActivePage := NewTabSheet;
PageControl1.ShowHint := False;
NewRichEdit := TRichEdit.Create(NewTabSheet);
NewRichEditSetup(NewRichEdit);
ActiveControl := NewRichEdit;
NewRichEdit.Modified := False;
end;
PROCEDURE Tform1.NewRichEditSetup(NewRE: TRichEdit)
//初始化RICHEDIT
BEGIN
WITH NewRE DO
BEGIN
Parent := NewTabSheet;
Align := alClient;
Modified := False;
END;
END;
end.
但如何在我按窗口右上角的大叉关闭按钮时候,能够提醒
用户并让打开的多个编辑区一一保存?
我做了很多办法都不行!特地来请教!谢谢您的帮助!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
PageControl1: TPageControl;
procedure Button1Click(Sender: TObject);
private
procedure NewRichEditSetup(NewRE: TRichEdit);
{ Private declarations }
public
NewTabSheet:TTabSheet;
NewRichEdit:TRichedit;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
NewTabSheet := TTabSheet.Create(PageControl1);
NewTabSheet.CAPTION := '未命名文档';
NewTabSheet.Hint := '未命名文档';
NewTabSheet.PageControl := PageControl1;
PageControl1.ActivePage := NewTabSheet;
PageControl1.ShowHint := False;
NewRichEdit := TRichEdit.Create(NewTabSheet);
NewRichEditSetup(NewRichEdit);
ActiveControl := NewRichEdit;
NewRichEdit.Modified := False;
end;
PROCEDURE Tform1.NewRichEditSetup(NewRE: TRichEdit)
//初始化RICHEDIT
BEGIN
WITH NewRE DO
BEGIN
Parent := NewTabSheet;
Align := alClient;
Modified := False;
END;
END;
end.