X
xwm21cn
Unregistered / Unconfirmed
GUEST, unregistred user!
在使用INTRAWEB的多线程时,如下编码中,预期
QueryForm.IWLabel1.Caption := 'test';
但界面并没有打印出'test',不知需要怎样处理,才能得到预期结果?
注:如果连续提交,偶尔会得到结果,但测试,绝大多时间,该值并不出现在界面上。
TClientThread = class(TThread)
private
sBuffer: BufferType;
// Private declarations
protected
procedure GiveAnswer;
public
procedure Execute;
override;
constructor Create(AQueryForm: TFormMain);
end;
constructor TClientThread.Create(AQueryForm: TFormMain);
begin
QueryForm := AQueryForm;
inherited Create(False);
end;
procedure TClientThread.GiveAnswer;
begin
QueryForm.IWTimerSubmit.Enabled := false;
QueryForm.IWLabel1.Caption := 'test';
end;
Procedure TClientThread.Execute;
begin
FreeOnTerminate := True;
Priority := tpNormal;
While (not Terminated)do
begin
Synchronize(GiveAnswer);
end;
end;
QueryForm.IWLabel1.Caption := 'test';
但界面并没有打印出'test',不知需要怎样处理,才能得到预期结果?
注:如果连续提交,偶尔会得到结果,但测试,绝大多时间,该值并不出现在界面上。
TClientThread = class(TThread)
private
sBuffer: BufferType;
// Private declarations
protected
procedure GiveAnswer;
public
procedure Execute;
override;
constructor Create(AQueryForm: TFormMain);
end;
constructor TClientThread.Create(AQueryForm: TFormMain);
begin
QueryForm := AQueryForm;
inherited Create(False);
end;
procedure TClientThread.GiveAnswer;
begin
QueryForm.IWTimerSubmit.Enabled := false;
QueryForm.IWLabel1.Caption := 'test';
end;
Procedure TClientThread.Execute;
begin
FreeOnTerminate := True;
Priority := tpNormal;
While (not Terminated)do
begin
Synchronize(GiveAnswer);
end;
end;