如何在 XUL 应用程序中使用进度表?
对于极客来说这可能是一个简单的问题,但至少对我来说不是。我正在从头开始开发一个简单的XUL程序。我使用 wizard
标签来简化向用户显示的 GUI。在 wizard
页面上,我插入了一个 progressmeter
来显示名为 myFunction()
的函数的进度,该函数属于 JavaScript,可在XUL 文件。如何根据函数的真实进度正确更新progressmeter
?
This might be a simple question for geeks, but not for me, at least. I was developing a simple XUL program from scratch. I used wizard
tag to simplify the GUI that appears to the user. On a wizard
page I have inserted a progressmeter
to show the progress of a function called myFunction()
which belongs to the JavaScript which is available in the XUL file. How can I properly update the progressmeter
based on the real progress of the function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,反向线程工作确实有效,但根据文档(此处:https://developer.mozilla .org/en/nsIThread) 如果没有待处理的事件,
processNextEvent
可能会等待很长时间!呃..由于 xulrunner 是单线程,因此似乎很少,导致速度大幅减慢。不过,摆动鼠标还是有帮助的。经过进一步调查,
use processNextEvent(false)
可以立即工作。Yes, the reverse thread work round does work, but as per the doc (here: https://developer.mozilla.org/en/nsIThread)
processNextEvent
may wait for a very long time if there are no pending events! Err.. sincexulrunner
is single thread there appear to be few, resulting in a huge slow down. Waggling the mouse helps though.On further investigation
use processNextEvent(false)
works without delay.您是否尝试过使用进度表的“value”属性来设置进度表的进度?
您只需根据函数的进展增加该值即可。
请注意,该值应设置在 0 和 myProgressmeter.max 之间
Have you tried setting the progression of the progressmeter using its "value" property?
You just need to increment this value depending on the progression of your function.
Note that the value should be set between 0 and myProgressmeter.max