写字板查找代码delphi

来源:百度知道 编辑:UC知道 时间:2024/05/04 03:50:23
里面的查找代码怎么写?、
procedure TForm1.FindClick(Sender: TObject);
var
foundpos,initpos:integer;
begin
initpos:=richedit1.SelStart+richedit1.SelLength;
foundpos:=pos(FindDialog1.FindText,copy(richedit1.text,initpos+1,length(richedit1.text)-initpos));
if foundpos>0 then
begin
richedit1.setfocus;
richedit1.selstart:=initpos+foundpos-1;
richedit1.sellength:=length(finddialog1.findtext);
end
else messagedlg('没找到要找的字符串',mtinformation,[mbok],0);
end;

我这样写一直出错
[Pascal Error] Unit1.pas(104): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(104): E2250 There is no overloaded version of 'Pos' that can be called with these arguments
[Pascal Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'
这是什么原因呢

哥们,第一句说:缺少操作符或分号,看看104行到底哪不对。
第二句说:没有过载版本的Pos函数,你的Pos函数的参数个数或类型不对。
最后一句说:不能编译使用单元“Unit1.pas",因为出错了。

foundpos:=pos(FindDialog1.FindText,copy(richedit1.text,initpos+1,length(richedit1.text)-initpos));
这句出错了,看看是不是Pos函数有冲突或Copy函数有冲突