Problem with busybar

Find quick help here to get you started with Hollywood
Post Reply
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Problem with busybar

Post by papiosaur »

Hello,

i have a problem with busybar... it move at the end of the scan... any idea please ?

Code: Select all

Function scan()

If Not HaveObject(#INTERVAL, 2) 
	SetInterval(2, p_BusybarTimer, 80)
	y = moai.get("listview", "Entries") - 1
	For i = 0 To y - 1
		a1$, a2$, a3$, a4$, a5$, a6$, a7$, a8$, a9$, a10$, a11$ = moai.domethod("listview", "getentry", i)
		p_change()
		moai.DoMethod("listview", "Rename", i, a1$, a2$, a3$, a4$, a5$, a6$, a7$, a8$, a9$, a10$, a11$, a11$)
	Next
Else
	ClearInterval(2)
	moai.DoMethod("busybar", "reset")
EndIf
	
EndFunction
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Problem with busybar

Post by jPV »

An interval function is only called when your program execution is at the WaitEvent() loop. So it doesn't get called in this for-next loop when you're going through the list.

You could do manual moai.DoMethod(id, "Move") to update the busybar inside your for-next loop, but I don't know how good it would look speedwise etc. Maybe it would be better to use Progressbar instead? You can set the max value to listview entries and then set level in the for-next loop to show the real progress.

BTW. you might have a bug there... you set y to entries minus one, but then you do minus one again in the For definition. So it'll be entries - 2 as total and the last entry won't be processed. Or is it intentional to not go through the whole list or would it be better as "For i = 0 To y"?
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Problem with busybar

Post by papiosaur »

Thanks a lot jPV !

You've right maybe progress bar will be better, the user will have an information about progression of scan.

I would like to use busybar for see the effet ;-)

About problem in For-next loop, in fact there is an mistake, i will correct that :-D
Post Reply