Y
yuyushuixing
Unregistered / Unconfirmed
GUEST, unregistred user!
我这学期刚学这门语言,开始的时候还可以,但最近遇到了这个问题.让我解决不了了,我都无奈了,系统提示: [error] unitl.pas[399]missing operator or semicolon
[error]unit1.pas[399]incompatible types:'string' and 'Tmenultem'
[fatal error]project1.dpr(5):could not compile used unit 'unit1.pas'
总是这样的语句出错,但这个语句有没错.我都郁闷死了!
then richedit1.Text:=copy(s,1,i-1)+new+copy(s,i+n,length(s)-(i+n)+1);
全程序是:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ComCtrls, ImgList, ActnList, StdActns, Spin,
ToolWin, ColorGrd, ExtActns, ExtCtrls;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
file1: TMenuItem;
new1: TMenuItem;
open1: TMenuItem;
fen: TMenuItem;
save1: TMenuItem;
printersetup1: TMenuItem;
d: TMenuItem;
saveas1: TMenuItem;
edit1: TMenuItem;
undo1: TMenuItem;
cut1: TMenuItem;
copy1: TMenuItem;
paste1: TMenuItem;
z: TMenuItem;
color1: TMenuItem;
find1: TMenuItem;
replace1: TMenuItem;
view1: TMenuItem;
mstatusbar1: TMenuItem;
mtoolbar1: TMenuItem;
largeicon1: TMenuItem;
smallicon1: TMenuItem;
x: TMenuItem;
report1: TMenuItem;
help1: TMenuItem;
about1: TMenuItem;
l: TMenuItem;
print1: TMenuItem;
dy: TMenuItem;
exit1: TMenuItem;
font1: TMenuItem;
list1: TMenuItem;
RichEdit1: TRichEdit;
PopupMenu1: TPopupMenu;
copy: TMenuItem;
cut: TMenuItem;
paste: TMenuItem;
undo: TMenuItem;
ActionList1: TActionList;
PrintDlg1: TPrintDlg;
EditSelectAll1: TEditSelectAll;
FileOpen1: TFileOpen;
FilePageSetup1: TFilePageSetup;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton4: TToolButton;
ToolButton3: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolBar2: TToolBar;
ComboBox1: TComboBox;
SpinEdit1: TSpinEdit;
ToolButton13: TToolButton;
ToolButton14: TToolButton;
ToolButton15: TToolButton;
ToolButton16: TToolButton;
ToolButton17: TToolButton;
ToolButton18: TToolButton;
ToolButton12: TToolButton;
ColorGrid1: TColorGrid;
usercolr1: TAction;
normal1: TMenuItem;
N1: TMenuItem;
style: TMenuItem;
ImageList3: TImageList;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
PopupMenu2: TPopupMenu;
RichEditBold1: TRichEditBold;
RichEditItalic1: TRichEditItalic;
RichEditUnderline1: TRichEditUnderline;
Action1: TAction;
RichEditAlignLeft1: TRichEditAlignLeft;
RichEditAlignRight1: TRichEditAlignRight;
RichEditAlignCenter1: TRichEditAlignCenter;
richeditleft1: TMenuItem;
richeditcenter11: TMenuItem;
richeditright11: TMenuItem;
FileOpen2: TFileOpen;
FileOpen3: TFileOpen;
FileOpenWith1: TFileOpenWith;
FileSaveAs1: TFileSaveAs;
FilePrintSetup1: TFilePrintSetup;
FilePageSetup2: TFilePageSetup;
FileRun1: TFileRun;
FileExit1: TFileExit;
StatusBar1: TStatusBar;
Timer1: TTimer;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
FontDialog1: TFontDialog;
ColorDialog1: TColorDialog;
PrintDialog1: TPrintDialog;
PrinterSetupDialog1: TPrinterSetupDialog;
FindDialog1: TFindDialog;
ReplaceDialog1: TReplaceDialog;
PageSetupDialog1: TPageSetupDialog;
EditDelete1: TEditDelete;
FileExit2: TFileExit;
procedure mstatusbar1Click(Sender: TObject);
procedure largeicon1Click(Sender: TObject);
procedure exit1Click(Sender: TObject);
procedure cut1Click(Sender: TObject);
procedure copy1Click(Sender: TObject);
procedure paste1Click(Sender: TObject);
procedure undo1Click(Sender: TObject);
procedure copyClick(Sender: TObject);
procedure cutClick(Sender: TObject);
procedure pasteClick(Sender: TObject);
procedure undoClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure ToolButton11Click(Sender: TObject);
procedure ToolButton14Click(Sender: TObject);
procedure ColorGrid1Change(Sender: TObject);
procedure usercolr1Execute(Sender: TObject);
procedure normal1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure RichEdit1Change(Sender: TObject);
procedure RichEdit1SelectionChange(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure new1Click(Sender: TObject);
procedure open1Click(Sender: TObject);
procedure save1Click(Sender: TObject);
procedure font1Click(Sender: TObject);
procedure color1Click(Sender: TObject);
procedure find1Click(Sender: TObject);
procedure FindDialog1Find(Sender: TObject);
procedure replace1Click(Sender: TObject);
procedure ReplaceDialog1Replace(Sender: TObject);
procedure saveas1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var fname:string='未命名';
procedure TForm1.mstatusbar1Click(Sender: TObject);
begin
mstatusbar1.Checked:=not mstatusbar1.Checked;
end;
procedure TForm1.largeicon1Click(Sender: TObject);
begin
largeicon1.Checked:= not largeicon1.Checked;
end;
procedure TForm1.exit1Click(Sender: TObject);
begin
form1.Close;
end;
procedure TForm1.cut1Click(Sender: TObject);
begin
richedit1.CutToClipboard;
end;
procedure TForm1.copy1Click(Sender: TObject);
begin
richedit1.CopyToClipboard;
end;
procedure TForm1.paste1Click(Sender: TObject);
begin
richedit1.PasteFromClipboard;
end;
procedure TForm1.undo1Click(Sender: TObject);
begin
richedit1.Undo;
end;
procedure TForm1.copyClick(Sender: TObject);
begin
richedit1.CopyToClipboard;
end;
procedure TForm1.cutClick(Sender: TObject);
begin
richedit1.CutToClipboard;
end;
procedure TForm1.pasteClick(Sender: TObject);
begin
richedit1.PasteFromClipboard;
end;
procedure TForm1.undoClick(Sender: TObject);
begin
richedit1.Undo;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items:=screen.Fonts;
combobox1.Text:=richedit1.Font.Name;
spinedit1.Value:=richedit1.Font.Size;
end;
procedure TForm1.ComboBox1Click(Sender: TObject);
begin
richedit1.Font.Name:=combobox1.Items[combobox1.Itemindex];
end;
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
if spinedit1.Value<>0
then richedit1.SelAttributes.Size:=spinedit1.Value;
end;
procedure TForm1.ToolButton7Click(Sender: TObject);
begin
richedit1.CutToClipboard;
end;
procedure TForm1.ToolButton8Click(Sender: TObject);
begin
richedit1.CopyToClipboard;
end;
procedure TForm1.ToolButton9Click(Sender: TObject);
begin
richedit1.PasteFromClipboard;
end;
procedure TForm1.ToolButton11Click(Sender: TObject);
begin
richedit1.Undo;
end;
procedure TForm1.ToolButton14Click(Sender: TObject);
begin
if toolbutton14.CheckMenuDropdown
then richedit1.Font.Style:=richedit1.Font.Style
else richedit1.Font.Style:=richedit1.Font.Style;
end;
procedure TForm1.ColorGrid1Change(Sender: TObject);
begin
richedit1.SelAttributes.Color:=colorgrid1.ForegroundColor;
colorgrid1.Visible:=false;
end;
procedure TForm1.usercolr1Execute(Sender: TObject);
begin
colorgrid1.Visible:=true;
end;
procedure TForm1.normal1Click(Sender: TObject);
begin
normal1.Checked:=not normal1.Checked;
toolbar1.Visible:=normal1.Checked;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
richedit1.SelAttributes.Name:=combobox1.Text;
end;
procedure TForm1.RichEdit1Change(Sender: TObject);
begin
combobox1.Text:=richedit1.SelAttributes.Name;
spinedit1.Value:=richedit1.SelAttributes.Size;
if richedit1.Modified
then statusbar1.Panels[1].Text:='Modified'
end;
procedure TForm1.RichEdit1SelectionChange(Sender: TObject);
begin
statusbar1.Panels[0].Text:='位置:'+inttostr(richedit1.CaretPos.Y+1)+'行'+inttostr(richedit1.CaretPos.X)+'列'
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
statusbar1.Panels[2].Text:=datetimetostr(now)
end;
procedure TForm1.new1Click(Sender: TObject);
begin
richedit1.clear;
getdir(0,fname);
fname:=fname+'/未命名';
statusbar1.Panels[3].Text:=fname;
end;
procedure TForm1.open1Click(Sender: TObject);
begin
if opendialog1.Execute
then begin
fname:=opendialog1.FileName;
richedit1.Lines.LoadFromFile(fname);
statusbar1.Panels[3].Text:=fname;
end;
end;
procedure TForm1.save1Click(Sender: TObject);
begin
if pos('未命名',fname)<>0
then if savedialog1.Execute
then begin
fname:=savedialog1.FileName;
richedit1.Lines.SaveToFile(fname);
statusbar1.Panels[3].Text:=fname;
end
else
richedit1.Lines.SaveToFile(fname);
end;
procedure TForm1.font1Click(Sender: TObject);
begin
if richedit1.SelLength>0
then begin
fontdialog1.Font.Assign(richedit1.SelAttributes);
if fontdialog1.Execute
then richedit1.SelAttributes.Assign(fontdialog1.Font);
end
else showmessage('请先选中一段文本');
end;
procedure TForm1.color1Click(Sender: TObject);
begin
if colordialog1.Execute
then richedit1.Color:=colordialog1.Color;
end;
procedure TForm1.find1Click(Sender: TObject);
begin
finddialog1.Execute;
end;
procedure TForm1.FindDialog1Find(Sender: TObject);
var i,k,n:integer;
s,find:string;
begin
find:=finddialog1.FindText;
n:=length(find);
i:=richedit1.SelStart +richedit1.SelLength;
//s:=copy(richedit1.Text,i+1,length(richedit1.Text)-i);
k:=pos(find,s);
if k>0
then begin
form1.Show;
richedit1.SelStart:=i+k-1;
richedit1.SelLength:=n;
end
else showmessage('已搜索完毕!');
end;
procedure TForm1.replace1Click(Sender: TObject);
begin
replacedialog1.Execute;
end;
procedure TForm1.ReplaceDialog1Replace(Sender: TObject);
var i,n:integer;
s,old,new:string;
begin
s:=richedit1.Text;
old:=replacedialog1.FindText;
n:=length(old);
new:=replacedialog1.ReplaceText;
i:=pos(old,s);
richedit1.SelStart:=i-1;
richedit1.SelLength:=n;
richedit1.SelText:=new;
if frreplaceall in replacedialog1.Options
then repeat
s:=richedit1.Text;
i:=pos(old,s);
if i<>0
then richedit1.Text:=copy(s,1,i-1)+new+copy(s,i+n,length(s)-(i+n)+1);
until i=0;
end;
procedure TForm1.saveas1Click(Sender: TObject);
begin
if savedialog1.Execute
then begin
fname:=savedialog1.FileName;
richedit1.Lines.SaveToFile(fname);
statusbar1.Panels[3].Text:=fname;
end;
end;
end.
[error]unit1.pas[399]incompatible types:'string' and 'Tmenultem'
[fatal error]project1.dpr(5):could not compile used unit 'unit1.pas'
总是这样的语句出错,但这个语句有没错.我都郁闷死了!
then richedit1.Text:=copy(s,1,i-1)+new+copy(s,i+n,length(s)-(i+n)+1);
全程序是:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ComCtrls, ImgList, ActnList, StdActns, Spin,
ToolWin, ColorGrd, ExtActns, ExtCtrls;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
file1: TMenuItem;
new1: TMenuItem;
open1: TMenuItem;
fen: TMenuItem;
save1: TMenuItem;
printersetup1: TMenuItem;
d: TMenuItem;
saveas1: TMenuItem;
edit1: TMenuItem;
undo1: TMenuItem;
cut1: TMenuItem;
copy1: TMenuItem;
paste1: TMenuItem;
z: TMenuItem;
color1: TMenuItem;
find1: TMenuItem;
replace1: TMenuItem;
view1: TMenuItem;
mstatusbar1: TMenuItem;
mtoolbar1: TMenuItem;
largeicon1: TMenuItem;
smallicon1: TMenuItem;
x: TMenuItem;
report1: TMenuItem;
help1: TMenuItem;
about1: TMenuItem;
l: TMenuItem;
print1: TMenuItem;
dy: TMenuItem;
exit1: TMenuItem;
font1: TMenuItem;
list1: TMenuItem;
RichEdit1: TRichEdit;
PopupMenu1: TPopupMenu;
copy: TMenuItem;
cut: TMenuItem;
paste: TMenuItem;
undo: TMenuItem;
ActionList1: TActionList;
PrintDlg1: TPrintDlg;
EditSelectAll1: TEditSelectAll;
FileOpen1: TFileOpen;
FilePageSetup1: TFilePageSetup;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton4: TToolButton;
ToolButton3: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolBar2: TToolBar;
ComboBox1: TComboBox;
SpinEdit1: TSpinEdit;
ToolButton13: TToolButton;
ToolButton14: TToolButton;
ToolButton15: TToolButton;
ToolButton16: TToolButton;
ToolButton17: TToolButton;
ToolButton18: TToolButton;
ToolButton12: TToolButton;
ColorGrid1: TColorGrid;
usercolr1: TAction;
normal1: TMenuItem;
N1: TMenuItem;
style: TMenuItem;
ImageList3: TImageList;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
PopupMenu2: TPopupMenu;
RichEditBold1: TRichEditBold;
RichEditItalic1: TRichEditItalic;
RichEditUnderline1: TRichEditUnderline;
Action1: TAction;
RichEditAlignLeft1: TRichEditAlignLeft;
RichEditAlignRight1: TRichEditAlignRight;
RichEditAlignCenter1: TRichEditAlignCenter;
richeditleft1: TMenuItem;
richeditcenter11: TMenuItem;
richeditright11: TMenuItem;
FileOpen2: TFileOpen;
FileOpen3: TFileOpen;
FileOpenWith1: TFileOpenWith;
FileSaveAs1: TFileSaveAs;
FilePrintSetup1: TFilePrintSetup;
FilePageSetup2: TFilePageSetup;
FileRun1: TFileRun;
FileExit1: TFileExit;
StatusBar1: TStatusBar;
Timer1: TTimer;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
FontDialog1: TFontDialog;
ColorDialog1: TColorDialog;
PrintDialog1: TPrintDialog;
PrinterSetupDialog1: TPrinterSetupDialog;
FindDialog1: TFindDialog;
ReplaceDialog1: TReplaceDialog;
PageSetupDialog1: TPageSetupDialog;
EditDelete1: TEditDelete;
FileExit2: TFileExit;
procedure mstatusbar1Click(Sender: TObject);
procedure largeicon1Click(Sender: TObject);
procedure exit1Click(Sender: TObject);
procedure cut1Click(Sender: TObject);
procedure copy1Click(Sender: TObject);
procedure paste1Click(Sender: TObject);
procedure undo1Click(Sender: TObject);
procedure copyClick(Sender: TObject);
procedure cutClick(Sender: TObject);
procedure pasteClick(Sender: TObject);
procedure undoClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure ToolButton11Click(Sender: TObject);
procedure ToolButton14Click(Sender: TObject);
procedure ColorGrid1Change(Sender: TObject);
procedure usercolr1Execute(Sender: TObject);
procedure normal1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure RichEdit1Change(Sender: TObject);
procedure RichEdit1SelectionChange(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure new1Click(Sender: TObject);
procedure open1Click(Sender: TObject);
procedure save1Click(Sender: TObject);
procedure font1Click(Sender: TObject);
procedure color1Click(Sender: TObject);
procedure find1Click(Sender: TObject);
procedure FindDialog1Find(Sender: TObject);
procedure replace1Click(Sender: TObject);
procedure ReplaceDialog1Replace(Sender: TObject);
procedure saveas1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var fname:string='未命名';
procedure TForm1.mstatusbar1Click(Sender: TObject);
begin
mstatusbar1.Checked:=not mstatusbar1.Checked;
end;
procedure TForm1.largeicon1Click(Sender: TObject);
begin
largeicon1.Checked:= not largeicon1.Checked;
end;
procedure TForm1.exit1Click(Sender: TObject);
begin
form1.Close;
end;
procedure TForm1.cut1Click(Sender: TObject);
begin
richedit1.CutToClipboard;
end;
procedure TForm1.copy1Click(Sender: TObject);
begin
richedit1.CopyToClipboard;
end;
procedure TForm1.paste1Click(Sender: TObject);
begin
richedit1.PasteFromClipboard;
end;
procedure TForm1.undo1Click(Sender: TObject);
begin
richedit1.Undo;
end;
procedure TForm1.copyClick(Sender: TObject);
begin
richedit1.CopyToClipboard;
end;
procedure TForm1.cutClick(Sender: TObject);
begin
richedit1.CutToClipboard;
end;
procedure TForm1.pasteClick(Sender: TObject);
begin
richedit1.PasteFromClipboard;
end;
procedure TForm1.undoClick(Sender: TObject);
begin
richedit1.Undo;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items:=screen.Fonts;
combobox1.Text:=richedit1.Font.Name;
spinedit1.Value:=richedit1.Font.Size;
end;
procedure TForm1.ComboBox1Click(Sender: TObject);
begin
richedit1.Font.Name:=combobox1.Items[combobox1.Itemindex];
end;
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
if spinedit1.Value<>0
then richedit1.SelAttributes.Size:=spinedit1.Value;
end;
procedure TForm1.ToolButton7Click(Sender: TObject);
begin
richedit1.CutToClipboard;
end;
procedure TForm1.ToolButton8Click(Sender: TObject);
begin
richedit1.CopyToClipboard;
end;
procedure TForm1.ToolButton9Click(Sender: TObject);
begin
richedit1.PasteFromClipboard;
end;
procedure TForm1.ToolButton11Click(Sender: TObject);
begin
richedit1.Undo;
end;
procedure TForm1.ToolButton14Click(Sender: TObject);
begin
if toolbutton14.CheckMenuDropdown
then richedit1.Font.Style:=richedit1.Font.Style
else richedit1.Font.Style:=richedit1.Font.Style;
end;
procedure TForm1.ColorGrid1Change(Sender: TObject);
begin
richedit1.SelAttributes.Color:=colorgrid1.ForegroundColor;
colorgrid1.Visible:=false;
end;
procedure TForm1.usercolr1Execute(Sender: TObject);
begin
colorgrid1.Visible:=true;
end;
procedure TForm1.normal1Click(Sender: TObject);
begin
normal1.Checked:=not normal1.Checked;
toolbar1.Visible:=normal1.Checked;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
richedit1.SelAttributes.Name:=combobox1.Text;
end;
procedure TForm1.RichEdit1Change(Sender: TObject);
begin
combobox1.Text:=richedit1.SelAttributes.Name;
spinedit1.Value:=richedit1.SelAttributes.Size;
if richedit1.Modified
then statusbar1.Panels[1].Text:='Modified'
end;
procedure TForm1.RichEdit1SelectionChange(Sender: TObject);
begin
statusbar1.Panels[0].Text:='位置:'+inttostr(richedit1.CaretPos.Y+1)+'行'+inttostr(richedit1.CaretPos.X)+'列'
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
statusbar1.Panels[2].Text:=datetimetostr(now)
end;
procedure TForm1.new1Click(Sender: TObject);
begin
richedit1.clear;
getdir(0,fname);
fname:=fname+'/未命名';
statusbar1.Panels[3].Text:=fname;
end;
procedure TForm1.open1Click(Sender: TObject);
begin
if opendialog1.Execute
then begin
fname:=opendialog1.FileName;
richedit1.Lines.LoadFromFile(fname);
statusbar1.Panels[3].Text:=fname;
end;
end;
procedure TForm1.save1Click(Sender: TObject);
begin
if pos('未命名',fname)<>0
then if savedialog1.Execute
then begin
fname:=savedialog1.FileName;
richedit1.Lines.SaveToFile(fname);
statusbar1.Panels[3].Text:=fname;
end
else
richedit1.Lines.SaveToFile(fname);
end;
procedure TForm1.font1Click(Sender: TObject);
begin
if richedit1.SelLength>0
then begin
fontdialog1.Font.Assign(richedit1.SelAttributes);
if fontdialog1.Execute
then richedit1.SelAttributes.Assign(fontdialog1.Font);
end
else showmessage('请先选中一段文本');
end;
procedure TForm1.color1Click(Sender: TObject);
begin
if colordialog1.Execute
then richedit1.Color:=colordialog1.Color;
end;
procedure TForm1.find1Click(Sender: TObject);
begin
finddialog1.Execute;
end;
procedure TForm1.FindDialog1Find(Sender: TObject);
var i,k,n:integer;
s,find:string;
begin
find:=finddialog1.FindText;
n:=length(find);
i:=richedit1.SelStart +richedit1.SelLength;
//s:=copy(richedit1.Text,i+1,length(richedit1.Text)-i);
k:=pos(find,s);
if k>0
then begin
form1.Show;
richedit1.SelStart:=i+k-1;
richedit1.SelLength:=n;
end
else showmessage('已搜索完毕!');
end;
procedure TForm1.replace1Click(Sender: TObject);
begin
replacedialog1.Execute;
end;
procedure TForm1.ReplaceDialog1Replace(Sender: TObject);
var i,n:integer;
s,old,new:string;
begin
s:=richedit1.Text;
old:=replacedialog1.FindText;
n:=length(old);
new:=replacedialog1.ReplaceText;
i:=pos(old,s);
richedit1.SelStart:=i-1;
richedit1.SelLength:=n;
richedit1.SelText:=new;
if frreplaceall in replacedialog1.Options
then repeat
s:=richedit1.Text;
i:=pos(old,s);
if i<>0
then richedit1.Text:=copy(s,1,i-1)+new+copy(s,i+n,length(s)-(i+n)+1);
until i=0;
end;
procedure TForm1.saveas1Click(Sender: TObject);
begin
if savedialog1.Execute
then begin
fname:=savedialog1.FileName;
richedit1.Lines.SaveToFile(fname);
statusbar1.Panels[3].Text:=fname;
end;
end;
end.