Page 1 of 1

Need good "busy" notification

Posted: Tue Feb 03, 2015 3:26 pm
by Kukulkan
Hello,

I have several actions that need processing of 2 and more seconds. I can't continue the main loop but I need some "busy" notification (best animated).

I considered changing the cursor-icon, but especially for Windows it needs to get refreshed in a loop and there is also a lack of good cross platform functionality. BTW, would be nice to have a SetWindowCursor() function in PureBasic.

I considered a thread, but updating any GUI thing is no good idea in PureBasic (see several forum entries about incompatibility between threads and GUI).

Any other idea for some kind of "busy" notifier?

Kukulkan

Re: Need good "busy" notification

Posted: Tue Feb 03, 2015 3:46 pm
by IdeasVacuum
If Windows only, you could run the Windows busy animation. If x-platform, then why not make your own animation?

Re: Need good "busy" notification

Posted: Tue Feb 03, 2015 4:47 pm
by JHPJHP
Hi Kukulkan,

This may be a PureBasic no-no, but I'll leave that for you to decide :)
- OpenWindow "can only" be called from the main thread (function: DisableDebugger)

Services, Stuff, and Shellhook
- Stuff/WindowStuff/TimerStuff
-- splash.pb
--- processing.gif

Cheers!

Re: Need good "busy" notification

Posted: Tue Feb 03, 2015 5:07 pm
by Kukulkan
Hello,

Thanks for your answers!

@IdeasVacuum: I need a cross platform solution.

@JHPJHP: This is making a window from inside a thread that contains a web-gadget that contains an animated gif. No bad idea. The only concern I have are possible issues if a thread is doing GUI... I will test it.

Kukulkan

Re: Need good "busy" notification

Posted: Tue Feb 03, 2015 7:10 pm
by Danilo
The main GUI thread should always run without bigger interruption times.
Put your processing stuff into threads and send update/state-messages to the GUI thread using PostEvent.

Re: Need good "busy" notification

Posted: Tue Feb 03, 2015 7:40 pm
by bbanelli
Kukulkan wrote:I considered a thread, but updating any GUI thing is no good idea in PureBasic (see several forum entries about incompatibility between threads and GUI).
This has been settled with BindEvent()/PostEvent() functions successfully on all platforms.

Re: Need good "busy" notification

Posted: Thu Feb 05, 2015 8:57 am
by dige
I do it like this:

1. open an hidden window, use a global datetime variable and
refresh the value within the mainloop with date().

2. create a thread that checks the value and if the difference
is higher than 3 seconds, unhide the window und play an anim.
You can use Canvas and StartDrawing(), because its seperated
for every thread.

3. the user should can click on closewindow to avoid seeing
the busy window and one button, to cancel the current operation.

greets, dige