Need good "busy" notification

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Need good "busy" notification

Post 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
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Need good "busy" notification

Post by IdeasVacuum »

If Windows only, you could run the Windows busy animation. If x-platform, then why not make your own animation?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
JHPJHP
Addict
Addict
Posts: 2250
Joined: Sat Oct 09, 2010 3:47 am

Re: Need good "busy" notification

Post 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!
Last edited by JHPJHP on Mon Feb 16, 2015 11:30 pm, edited 6 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Need good "busy" notification

Post 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
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Need good "busy" notification

Post 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.
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 544
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: Need good "busy" notification

Post 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.
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Need good "busy" notification

Post 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
"Daddy, I'll run faster, then it is not so far..."
Post Reply