加载前刷新标签标题?

pro*_*tor 2 delphi

我有一段代码:

setEnableControls(false);
lblLoading.Caption:='Loading tree contents, please wait.';
someBigLoading(); 
setEnableControls(true);
lblLoading.Caption:='';
Run Code Online (Sandbox Code Playgroud)

问题是,标签的标题文本在"大加载"完成之后才会刷新.有没有办法让程序在消息队列中处理消息,然后进入下一个命令?

gab*_*abr 8

打电话吧lblLoading.Update.这将更新标签,不会引入任何可能因代码中间处理消息而引发的问题.

  • @Goran_Mandic避免Application.ProcessMessages(); 只要可能,因为[它通常会导致重入问题](http://delphi.about.com/od/objectpascalide/a/delphi-processmessages-dark-side.htm) (2认同)