How to exchange date between GUI and a background thread?

I will start a global background task in a thread after client start, but how could I visit UI components in this thread?

I now use:

  1. Client tags
  2. Window or control’s custom properties

Is this a right way?

This background task thread - are you running it on the gateway or via a background thread in the client? If via a background thread on the client using system.util.invokeAsynchronous then you necessarily must use system.util.invokeLater to affect the GUI, otherwise you risk freezing your GUI. The documentation has an example - system.util.invokeAsynchronous - Ignition User Manual 7.8 - Ignition Documentation

Client tags are a safe way to pass data between GUI (foreground) and an asynchronous thread (background). Directly accessing window objects and the components within them is not safe. You have to delegate to short functions in the foreground to make any changes and safely read values. This topic discusses the relevant techniques:

1 Like

Actually, Your answer makes me realized that my question is how to exchange data between thread and GUI. I will use client tags, Thanks for you suggest.