CnPack Forum


 
Subject: 关于ProgressForm的bug
xierenxixi
新警察
Rank: 1



UID 36651
Digest Posts 0
Credits 33
Posts 10
点点分 33
Reading Access 10
Registered 2008-1-24
Status Offline
Post at 2008-3-6 16:27  Profile | Blog | P.M. 
关于ProgressForm的bug

当在一个showmodal的窗体上用这个进度条时,关闭后showmodal的窗体会变成不是showmodal的,
这时点主窗体可以把这showmodal窗体给隐藏掉,
原因就是这个的formlist被禁窗体引起的
如图修改代码就不会出现这种问题

procedure ShowProgress(Aowner:TComponent;const Title: string);
var
  i: Integer;
begin
  if not Assigned(ProgressForm) then
    ProgressForm := TProgressForm.Create(Aowner)
  else
    ProgressForm.BringToFront;
  if Title<>'' then
      ProgressForm.lblTitle.Caption := Title;
  ProgressForm.Show;
//这里不用那个循环
  WindowList:=DisableTaskWindows(ProgressForm.Handle);  
  ProgressForm.Update;
end;

procedure HideProgress;
var
  i: Integer;
begin
  if not Assigned(ProgressForm) then Exit;
//关闭改为这样
  EnableTaskWindows(WindowList);
  ProgressForm.Close;
  Application.ProcessMessages;
  ProgressForm.Free;
  ProgressForm := nil;
end;
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2008-3-8 10:09  Profile | Blog | P.M. 
感谢指出,已经按照您的提示改正。
另外,能否帮忙写个简单例子验证一下修改后的效果?
Top
xierenxixi
新警察
Rank: 1



UID 36651
Digest Posts 0
Credits 33
Posts 10
点点分 33
Reading Access 10
Registered 2008-1-24
Status Offline
Post at 2008-3-8 11:27  Profile | Blog | P.M. 
好的,要等等,过两天提供给你
Top
xierenxixi
新警察
Rank: 1



UID 36651
Digest Posts 0
Credits 33
Posts 10
点点分 33
Reading Access 10
Registered 2008-1-24
Status Offline
Post at 2008-3-8 11:32  Profile | Blog | P.M. 
在附件中,你看下,点时是showmodal,再点里面那按钮弹出进度条后就不是的了


Attachment: Project1.rar (2008-3-8 11:32, 163.09 K)
Download count 456
Top
xierenxixi
新警察
Rank: 1



UID 36651
Digest Posts 0
Credits 33
Posts 10
点点分 33
Reading Access 10
Registered 2008-1-24
Status Offline
Post at 2008-3-8 11:33  Profile | Blog | P.M. 
我只写了这点代码
procedure TForm2.Button1Click(Sender: TObject);
begin
  ShowProgress('1232');
  Sleep(1000);
  UpdateProgress(100);
  HideProgress
end;
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2008-3-8 21:52  Profile | Blog | P.M. 
感谢测试。目前CnPack的CVS上的代码已经按照您的提示进行了修改,如果您能访问CVS的话可下载更新最新代码来重新检验这个问题。

如何获得最新代码请参考:
http://bbs.cnpack.org/viewthread.php?tid=1882&extra=page%3D1
Top
xierenxixi
新警察
Rank: 1



UID 36651
Digest Posts 0
Credits 33
Posts 10
点点分 33
Reading Access 10
Registered 2008-1-24
Status Offline
Post at 2008-3-8 23:16  Profile | Blog | P.M. 
好的,发现问题我会报告的,
Top
 




All times are GMT++8, the time now is 2024-11-22 06:37

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.009173 second(s), 8 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP