Page 1 of 1

Have a progress during a job

Posted: Mon Jun 30, 2025 12:11 am
by walkero
Hello guys. I have a dialog where the user selects a few options and then clicks a button to create an item. This creation process might take some time, and while this is happening I would like to provide information to the user for the process. Unfortunately, when the button is pressed and the process starts, nothing can be done until the whole process is finished.
For example, if the process was the following, all the messages appear in the log listview at the end, and the busybar doesn't work as well

Code: Select all

			Case "testButton":
				moai.DoMethod("logbox", "Clear")
				SetInterval(1, p_BusybarTimer, 80)
				Wait(5, #SECONDS)
				p_Log("logbox", "Step 1", "Info")

				Wait(5, #SECONDS)
				p_Log("logbox", "Step 2", "Info")

				Wait(5, #SECONDS)
				p_Log("logbox", "Step 3", "Info")

				Wait(5, #SECONDS)

				ClearInterval(1)
				moai.DoMethod("automaticBusybar", "reset")
Anything else I should try?

Re: Have a progress during a job

Posted: Mon Jun 30, 2025 5:52 am
by plouf
if i understand correctly
there is how linux and hollywood works :)

coding style suggested by Andreas -> viewtopic.php?p=20245#p20245
Your script must NOT block (Wait()) execution, but intead use RunCallback() to push functions, like progress status bar update, in the queue.

Re: Have a progress during a job

Posted: Mon Jun 30, 2025 3:38 pm
by walkero
@plouf
Thank you so much for pointing me in the right direction. The information there was the right one, and I managed to make it work as I wanted. Thank you again for your help.