Charging window

Hello!

I was looking for information about how create a “charging window” bar or some other component that indicates the window is opening (doing calculations, etc). Does anybody have an idea?

Thanks for your answers! :thumb_left:

You mean besides the progress circle in the upper right corner?

Yes, because sometimes when doing a query the component waiting for the data turns red until it gets the result.

Well, how about using a script to execute the query?

Turn on an image similar to what I have here-- or whatever you want-- just before the query. Turn it off again just after.







I’m going to take that back for a bit, as I can no longer make an animated gif work. I know I’ve used them before. :open_mouth:

Ok, I take back my take-back! :laughing: For whatever reason, you can’t use an animated gif in an image object. But, you can use them in a label object…

  1. You can make your own modern looking loading indicator gifs at http://www.ajaxload.info/

  2. You can use a progress bar, just check the “indeterminate” property and it will bounce back-and-forth.

How can I activated? I mean, there’s not any property that I can use to activate the image

Thanks!

Put them in a label component and use the visible property on the label. :slight_smile:


I found a component called ‘progress bar’ the only thing I would need is to know when the project stops querying the database. The purpose of creating this component is let the clients know when all is retrieved…

You can change the progress bar properties right before and right after your queries, but you will have to use invokeLater() to do so, since it is modifying the GUI. Using invokeAsynchronous() will ensure the queries don’t hold up the UI thread (i.e., freeze the designer/client).

[code]def doAsynch(event=event):
import system

def doLater(event=event):
    event.source.parent.getComponent("Progress Bar").visible = 1
system.util.invokeLater(doLater)

# put your queries here

def doLater(event=event):
    event.source.parent.getComponent("Progress Bar").visible = 0
system.util.invokeLater(doLater)

system.util.invokeAsynchronous(doAsynch)[/code]

I’ve tried your sample, James, but it still freeze the designer/client.

I use this:

[code]def doAsynch(event=event):
import system

def doLater(event=event):
    #event.source.parent.getComponent("ProgressBar").visible = 1
    event.source.parent.getComponent("Label 3").visible = 1
system.util.invokeLater(doLater)

# put your queries here
for x in range(4000):
	print "this will print" + str(x) + " times"

def doLater(event=event):
    #event.source.parent.getComponent("ProgressBar").visible = 0
    event.source.parent.getComponent("Label 3").visible = 0
system.util.invokeLater(doLater)

system.util.invokeAsynchronous(doAsynch)[/code]

The label with ani gif (or progress bar with indeterminate) is showing, but it’s not ‘moving’… in fact whole window is freezed. Also in console it will show first few prints and then after script is finished, all other prints shows.
I use latest version of Ignition (7.5.5).

I really need something to tell the operator, that something is going on in the background…

This code should work fine, the hard loop just isn’t a very good simulation of a query since it actually interacts with the UI (by printing things to the console).

Replace that loop with:

import time time.sleep(10)

for a better simulation of how a long-running query would act.