V
volcanosh
Unregistered / Unconfirmed
GUEST, unregistred user!
过程直接自己写好后再在type中加入可以了吗?
但下面这段老是说Undeclareed identifier 'ResultShow',怎么解决?
type
TfrmMain = class(TForm)
lblResult: TLabel;
lblShow: TLabel;
MainMenu1: TMainMenu;
M1: TMenuItem;
mmiOpen: TMenuItem;
D1: TMenuItem;
E1: TMenuItem;
dlgOpen: TOpenDialog;
lblPort: TLabel;
lblTime: TLabel;
Timer1: TTimer;
comPa: TComm;
comPb: TComm;
procedure mmiOpenClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ReadScriptFile(filename:string);
procedure ResultShow(str:string);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure ReadScriptFile(FileName:String);
var
strLine:string;
begin
Assignfile(ScriptFile,'ScriptFileName');
Reset(ScriptFile);
While NOT SeekEOF(ScriptFile) do
begin
readln(scriptfile,strline);
if copy(strline,1,1)='d' then ResultShow(strline);
//if copy(strline,1,1)='(' then Send(strline);
end;
closefile(ScriptFile);
end;
procedure ResultShow(str:string);
var
ResultLine:string;
i:integer;
begin
//i:=pos('d',str);
for i:=1 to length(str) do
begin
if str='s' then
lblResult.caption:=copy(str,2,i-1);
end;
end;
但下面这段老是说Undeclareed identifier 'ResultShow',怎么解决?
type
TfrmMain = class(TForm)
lblResult: TLabel;
lblShow: TLabel;
MainMenu1: TMainMenu;
M1: TMenuItem;
mmiOpen: TMenuItem;
D1: TMenuItem;
E1: TMenuItem;
dlgOpen: TOpenDialog;
lblPort: TLabel;
lblTime: TLabel;
Timer1: TTimer;
comPa: TComm;
comPb: TComm;
procedure mmiOpenClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ReadScriptFile(filename:string);
procedure ResultShow(str:string);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure ReadScriptFile(FileName:String);
var
strLine:string;
begin
Assignfile(ScriptFile,'ScriptFileName');
Reset(ScriptFile);
While NOT SeekEOF(ScriptFile) do
begin
readln(scriptfile,strline);
if copy(strline,1,1)='d' then ResultShow(strline);
//if copy(strline,1,1)='(' then Send(strline);
end;
closefile(ScriptFile);
end;
procedure ResultShow(str:string);
var
ResultLine:string;
i:integer;
begin
//i:=pos('d',str);
for i:=1 to length(str) do
begin
if str='s' then
lblResult.caption:=copy(str,2,i-1);
end;
end;