Page 1 of 1

Problem with busybar

Posted: Wed May 24, 2023 2:56 pm
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

Re: Problem with busybar

Posted: Wed May 24, 2023 6:24 pm
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"?

Re: Problem with busybar

Posted: Wed May 24, 2023 6:50 pm
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