Have a progress during a job

Discuss GUI programming with the RapaGUI plugin here
Post Reply
walkero
Posts: 13
Joined: Fri Jul 29, 2022 11:59 pm

Have a progress during a job

Post 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?
plouf
Posts: 666
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Have a progress during a job

Post 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.
Christos
walkero
Posts: 13
Joined: Fri Jul 29, 2022 11:59 pm

Re: Have a progress during a job

Post 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.
Post Reply