简体   繁体   中英

How to use progressmeter in an XUL application?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM