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 availabl开发者_StackOverflow中文版e in the XUL file. How can I properly update the progressmeter
based on the real progress of the function?
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.. since xulrunner
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.
Have you tried setting the progression of the progressmeter using its "value" property?
myProgressmeter.value = 50;
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
精彩评论