Loading like symbol in vision

Hi,

I would like to know whether there is an option vision to display 'loading' like toastr whenever we click on search/load button.
I have tried using a label to make it appear for few seconds but i would like to explore toastr kinda thing.

Any suggestions?

Properly doing this is somewhat complicated.

The only "off the shelf" component to display a "loading" message is the progress bar, set to "indeterminate". If you don't want to use that, you could set up a label or image component with a loading GIF or whatever else you want.

Then the trick becomes safely using a background thread to perform any long-running calculation without any risk of deadlocking the UI.

I would start by reading up on Swing's "Event Dispatch Thread", both externally and on this forum.
The general pattern for a complex operation like this is:

  1. Do it all through scripting, so you have control over order of operations and flow.
  2. At the beginning of your script, while you're still on the EDT, show your "loading" indicator.
  3. Launch an asynchronous script (system.util.invokeAsynchronous) so you're moved off the EDT.
  4. Every time you want to indicate progress, including the final completion, move back to the EDT by calling system.util.invokeLater from your async thread.
1 Like

No, the EasyChart has a "Loading" indicator that you can enable.

Further to Paul's suggestions, you might find this topic helpful (old but still valid):

3 Likes

What is loading, a dataset(s)? I use something like this (only works because I know each dataset MUST have more than one row) to let me know when some data is loading for a window

len({Root Container.purchaseOrderData})>0
&&
len({Root Container.projectData})>0
&&
len({Root Container.locationChoices})>0
&&
len({Root Container.initialData})>0

as an expression. Then bind this to some visibility of a loading image/gif or progress bar or whatever you are trying to show while things load.

Alternatively if its a table, there is a .propertiesLoading, that is helpful as well. I've used that before to turn on a "Loading..." image based on if it is true or false.

1 Like

But i would like to display a symbol like below,


What i am trying to do here?:
I have created a template with the shapes and timer with below script:

vTimer = event.source.value

from java.awt import Color
if  (vTimer % 2) == 0:
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path').fillPaint = Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path 1').fillPaint = Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path 2').fillPaint = Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path 3').fillPaint = Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path').fillPaint =Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path 1').fillPaint =Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path 2').fillPaint =Color.BLACK
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path 3').fillPaint =Color.BLACK
else:
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path').fillPaint = Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path 1').fillPaint = Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path 2').fillPaint = Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Major').getComponent('Path 3').fillPaint = Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path').fillPaint =Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path 1').fillPaint =Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path 2').fillPaint =Color.WHITE
	event.source.parent.getComponent('Tick marks').getComponent('Group_Tick_Mark_Minor').getComponent('Path 3').fillPaint =Color.WHITE

Running status of timer has been binded to a vision client tag.
So whenever u hit on load button , this symbol will be displayed by enabling the vision tag,
But this symbol should go off only when after the data to table has been loaded.
I have tried the same functionality with a label , but it is not displaying as expected, even tried the same with indeterminate progress bar.
Any ideas to achieve this

During the "loading" process, is the gui locked? What exactly is being loaded, and how is it being called?

Below is the code i have used in load button

event.source.parent.parent.getComponent('Load').visible = True
system.tag.writeBlocking("[client]Load",[1])
event.source.parent.parent.stDate =event.source.parent.getComponent('StartDate_dropdown').date
event.source.parent.parent.endDate =event.source.parent.getComponent('EndDate_dropdown').date

vData=event.source.parent.parent.getComponent('Overall_Loss_Time_Table').data
vProcessArea = event.source.parent.parent.Process
vStartDate   = event.source.parent.getComponent('StartDate_dropdown').date
vEndDate     =event.source.parent.getComponent('EndDate_dropdown').date
vEqId        = event.source.parent.parent.MachineNo
vMinutes 	=  event.source.parent.getComponent('Filter_Dropdown').selectedValue
vShift 		=event.source.parent.getComponent('Shift_dropdown').selectedStringValue
vState=event.source.parent.getComponent('State_Dropdown').selectedStringValue

params       = {"iProcessArea":vProcessArea,"iState":vState, "SDate":vStartDate, "EDate":vEndDate , "iEqId":vEqId,"iMinute":vMinutes,"iShift":vShift}
dataSet      = system.db.runNamedQuery("MachineBoard/getLossTime", params)

#bind data set to table
#event.source.parent.parent.getComponent('Table').data= dataSet
event.source.parent.parent.getComponent('Overall_Loss_Time_Table').data= dataSet
event.source.parent.parent.getComponent('Load').visible = False
system.tag.writeBlocking("[client]Load",[0])

Yea I would not do it like this. It looks like you are just supplying components from your filters to the parameters of a named query - which is a good start.

However, then you are just assigning it to a table data property.

Why not

  1. Bind your table data property to your named query and bind the parameters to your various component values? Then you won't have to manually script this (and imo it is better to bind over script where possible and this is certainly one of those times).
  2. Your table should have a .propertiesLoading property. Bind your loading GIF visibility to property to Root Container.table.propertiesLoading or whatever the path may be - therefore if your data is in the process of being built, your loading symbol appears.
  3. You can also bind your table visibility to !{Root Container.table.propertiesLoading} if you want - therefore only either your loading GIF or your table will be viewable, but not both at the same time.
1 Like