Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
25
Erster Beitrag:
vor 5 Monaten, 1 Woche
Letzter Beitrag:
vor 4 Monaten, 4 Wochen
Beteiligte Autoren:
John Fligg, Luis Antonio Gutiérrez Flores, André Labuschagné, Piet van Zanten, JP, steve erts

Infinite Progress Bar

Startbeitrag von John Fligg am 17.08.2017 09:58

Hi, I am having trouble implementing an Infinite Progress Bar.

I am trying ThreadExecute to open a Sister Window but having no success. Basically I need to find out how to make the progress bar animate.

Does anyone have a small app demonstrating how to do this or explain the logic of what needs to be done.

I do wonder if what I am actually trying to do is complicating this.

In my Login Window based on a response I then want to display a progress bar while a daisy chain of procedures run (including accessing a remote server) and show the progress bar animated while all this happens in the background.

I hope this makes sense. Thanks so much in anticipation.

John

Antworten:

Hi John,

You can use an image with animated gif to show that someting is happening.
Additionally you can also use some progress in a progressbar.
Set the maximum value to the number of procedures that need to be done an increment the progressbar when a procedure has finished.
On top of that you can also display "connecting to server", "loading data" etc.

Kind regards,
Piet

von Piet van Zanten - am 17.08.2017 10:49
Thank you Piet. Do you need to run the procedures in another thread (ThreadExecute)?

Thx

von John Fligg - am 17.08.2017 11:08
Hi John,

As the user needs to wait for the login process to finish anyway, there's no need for another thread.
Don't forget to do a multitaskredraw to update the controls:

img_Wait..visible=true //show your animated gif.
stc_Message..visible=true
stc_Message="Connecting to the server"
multitaskredraw()
Procedure1()
PROGBAR_ProgBar1 = 1

stc_Message="Loading data"
multitaskredraw()
Procedure2()
PROGBAR_ProgBar1 = 2
multitaskredraw()
etc.
img_Wait..visible=false

You could also show these controls and do the procedures in a small child window. Then you don't need to do the visible/invisible stuff.

Kind regards,
Piet

von Piet van Zanten - am 18.08.2017 12:09
Thank you Piet. I have been trying all sorts.

I have actually got the control working and animated but once the procedure has finished I cannot find out how to return to the MainThread. There is a command to stop the secondary thread but it is not available in Android. That is so frustrating.

So I will try your method Piet but I do need to implement the animated control at some stage elsewhere.

Many thanks

John

von John Fligg - am 18.08.2017 12:14
I do not believe this.

Multitaskredraw is not available in Android.

John

von John Fligg - am 18.08.2017 12:43
Hi John,

Sorry to hear that, I thought you were using Windev.

Kind regards,
Piet

von Piet van Zanten - am 18.08.2017 13:34
Exceedingly annoying. But even so I can work round it but the animated image does not animate. Grrrr.

I have set the Properties and also made sure it is animated using code.

I think I might just give up on this one!

von John Fligg - am 18.08.2017 13:49
In windev mobile you can't use gifs as animated images, you need svg images, if you want to play a gif you can use an HTML control and write html code as if you were doing an HTML page with only the img src tag. Other workaround is to use the hourglass, it is an infinite progress bar and you can write the thing you want it to say. For example:

NextTitle("Loading...")
Hourglass(True)
FOR EACH USER
Multitask(-1)
//Some process
END
Hourglass(False)
NextTitle("")

If you don't write the multitask the animation won't move. Hope this helps, if you are using HTTPRequest to download things there's another way you can do it with a progressbar, in that case you could use HTTPProgressBar before HTTPDestination.

von Luis Antonio Gutiérrez Flores - am 18.08.2017 14:31
Thank you Luis I was not aware they had to be SVG, The odd thing is that I used the animated GIF's provided by PCSoft.

John

von John Fligg - am 18.08.2017 16:36
Hi,

I have a similar issue that I have not been able to solve.

When I am running long processes I call a small pop up window using

opensister(win_processing)

and then close that window when the process is complete.

I would like an infinite progress bar to display and re-animate in the "win_processing" window but have not been able to get to work.

I'm using windev 20.

Is this possible? Tips?

Thanks!

Steve

von steve erts - am 18.08.2017 18:42
I guess the problem is just in Mobile,'cuz the animated gifs do work in other platforms, I notice this when upgrading to version 22 where a new control of animated images was introduced, I needed to put some gifs in my app, but they didn't move, when I selected a predefined animated image I notice that those were svg instead of gifs.

And as for Steve you could use the hourglass function and before calling the Hourglass use multitaskredraw and then display a gif, haven't done this but it may work, also tried to do the same thing you are doing with a small window and didn't manage to make it work

von Luis Antonio Gutiérrez Flores - am 18.08.2017 18:46
Well I have managed to move forward slightly.

It seems that the animated GIF's DO work despite being a GIF. So the SVG format is a red herring.

If you place an animated control on the page it works. The problem is this:

If you make the control visible or not or try putting it in another window/plane the animation stops.

Am going to explore putting the control off the screen then moving it on using X/Y to see if that works.

von John Fligg - am 19.08.2017 09:06
Hi John

Do let us know if you ever get this resolved.

Cheers
André

von André Labuschagné - am 22.08.2017 06:11
I've given up Andre. I know it is something to do with running the procedures on another thread, which I have done. The Main thread is supposed to control the animation. But it just does not work, as simple as that.

von John Fligg - am 22.08.2017 07:45
Just use the Hourglass function, it is an infinite progress bar

von Luis Antonio Gutiérrez Flores - am 23.08.2017 17:36
It is not available in iOS. Apple do not like anything like this being used.

von John Fligg - am 24.08.2017 07:57
I'm using the hourglass in iOS
[attachment 2431 Captura-compressor.png]

von Luis Antonio Gutiérrez Flores - am 24.08.2017 14:54
Hmm must have been mistaken. Ah now I remember. Yes it Is available but at the time I was looking at pubishing to the Store. Then I heard that an Hourglass is rejected by Apple when having your app scrutinized. However I do not use the Stores so maybe I will look at this again. Thx.

von John Fligg - am 25.08.2017 07:53
Hi John

I am using the hourglass and it does work. But I also always display a message so that the user knows what is happening. If software on hardware does not always tell warmware what is happening they tend to think the thing is hanging and it is in an infinite loop.

But best keep way from the progress bars. I also never got them to work.

Cheers
André

von André Labuschagné - am 25.08.2017 11:37
What Msg command are you using out of curiosity? Obviously if you use Info() then the user has to press a key. So it has to be something not requiring a response. Thx.

von John Fligg - am 25.08.2017 13:04
For the message being displayed while the hourglass is showing you can use NextTitle("Text you want to show") and then call Hourglass(True)

von Luis Antonio Gutiérrez Flores - am 25.08.2017 21:30
John - I am simply hiding and making visible a string that has a good background colour. It is that simple. I place it on plane 0 - together with other bits and bobs. It has proved to be quite effective. Humans no longer wonder what is going on.

I have not tried Luis's suggestion.

André

von André Labuschagné - am 26.08.2017 05:50
Steve,

I have found that an animated gif will not animate in the sister window unless you call it in a seperate thread. Then run your processess. Then close the sister window. This is what I have done.

von JP - am 26.08.2017 06:51
Thx. NextTitle does not seem to work. And displaying a hidden string doesn't either.

I now think this is something to do with timing. After I click an OK button to start of the process/es nothing seems to work until everything has finished.

In other words, for Android only, once the button has been pressed nothing will redisplay until the other processes complete. Not even changing a plane of making a control visible.

Hourglass does work but NextTitle does not do anything.

Very very frustrating indeed. But Windows and iOS are fine it's just Android which seems to be the issue.

von John Fligg - am 26.08.2017 09:23
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.