Problem using invokeLater

I have a requirement to populate a list when a window opens and highlight a number of the list entries. I have tried to do this by binding the list to a SQL query, then running the code to highlight the list entries in a function which is run using system.util.invokeLater to ensure the list is populated before I try to highlight anything. This works on our internal network, but fails when run on the customer’s network. Testing shows that the list has not been populated by the time the code in the function runs. The only way I can get it to work with invokeLater is to add a delay of a couple of seconds.

It would appear that invokeLater is not working as advertised. The manual says invokeLater “calls the given Python function object after all of the currently processing and pending events are done being processed, or after a specified delay”. Are bound SQL queries not included in this?

Our office server is running Ubuntu 10.04 64-bit. The customer’s server is running Windows 2008 server. Both machines are running Ignition 7.2.7.

The invokeLater’s “calls the given Python function object after all of the currently processing and pending events are done being processed, or after a specified delay” is referring to the rest of the script that it is called from. So this means that it doesn’t wait for the screen to finish.

I would put your script on a propertyChange event on the list component. That way you can fire the script after your dataset has finished loading.

Thanks for clearing up that confusion Bobby. I’ve put the code in the list’s propertyChange event and run it when the dataset is finished loading by using the following check at the start of the code:if event.propertyName == "data":

Yeah, the “pending events” that the user manual describes are pending Swing events. These have nothing to do with background binding tasks like running queries.

Using the property change event like you did is the best way to achieve the results you wanted.