我有一個Lazarus項目有兩種形式,FormMain
和OutputForm
。我想在此代碼的第二形式展現在OutputMemo
一個輸出:使用另一種形式的控件
procedure FormMain.ShowButton(Object: Sender);
begin
if SaveDialog1.Execute then
AProcess := TProcess.Create(nil);
AProcess.CommandLine := 'gcc.exe ' + SaveDialog1.FileName + ' -o ' TextField23.Text;
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
AProcess.Execute;
OutputForm.OutputMemo.Lines.BeginUpdate;
//OutputForm.OutputMemo.Lines.Clear;
OutputForm.OutputMemo.Lines.LoadFromStream(AProcess.Output);
OutputForm.OutputMemo.Lines.EndUpdate;
AProcess.Free;
end;
但是當我嘗試編譯這段代碼,我得到了錯誤:
Identifier not found "OutputForm"
在OutputForm單元的頂部我有:
unit Output;
當我嘗試從FormMain單元(OutputForm: Output;
)調用它,我得到這個錯誤:
Error in type definiition
我該怎麼辦?
嘗試將OutputForm的單位添加到uses子句。 – RRUZ 2009-12-28 17:00:41
如何做到這一點? – 2009-12-28 17:01:34
更新了我的回覆。 – 2009-12-28 18:29:18