How to change visibility during a event script to hide the table that is updating?

I’m using an event scrip to update a table from opc tags, with browse. The browse and read takes a few seconds, in that time the table is out of date. I tried to fill the table with an empty header and data, and I’ve tried covering it with a label.

if event.propertyName == "path":
    import system, time, mfg_IgnitionLib as tb
    
    Updating = event.source.getComponent('Updating')
    Updating.visible = True
    ####### Start    
    start = time.time()            
    
    opcServer = "TcOpcUaServer@Factory1"
    rootOPCPath = event.source.path
    ConfigTagTable = event.source.getComponent('Configuration Tags')
    ConfigTagTable.data = tb.getTableData(opcServer, tb.browseCfg(opcServer,rootOPCPath,0,1))
    Updating.visible = False
    #results = writeOPCfromTable(opcServer, rootOPCPath, ConfigTagTable.data)
    tb.logger.info('Read OPC Complete : { "totalTime" : "%s"}' %(time.time() - start))

You can move long running tasks you want to do to an asynchronous thread, using system.util.invokeAsynchronous.

Note the caution at the top of the manual, which I'll repeat here:

Caution

This function should not be used to asynchronously interacts with the GUI in Vision. This means interacting with window navigation, setting and getting component properties, showing error/message popups, and really any other methods that can interact with components and windows. If you need to do something with the GUI in Vision with this function, this must be achieved through a subsequent call to system.util.invokeLater.

A bit of clarification:

Your event script runs in the foreground, and Java Swing is single threaded for all component updates. Which means your attempts to hide or alter a component will not be drawn until you give up the CPU (finish your event script).

Long old thread here, but still valid:

1 Like