Example using new thread

Is there any real world example or video of using the new thread to update a progressbar?

The blog post has a Video, but that’s not in english. I have multiple places I would like to use this but require some kind of example.

Thanks!

Check out the two examples here:

Examples/Desktop/UpdatingUIFromThread

How can you trigger something when the thread is done?

Are we talking Web Or Desktop?

Desktop

make it so the timer runs one more time at the end of the run event and raises a different event than the ones it would raise when the thread was running

Or push an “I’m done” UI update message as the last line of the thread.

Thank you guys, I think I got a handle on it now.

[quote=492885:@Paul Lefebvre]Check out the two examples here:

Examples/Desktop/UpdatingUIFromThread[/quote]
Thanks, Paul.

I believe that the project “UIThreadUpdate” provides the solution that @Bob Keeney was suggesting in his 2019 XDC presentation Design Mistakes We All Regret Later in his “Tight Loops/UI Freeze” discussion.
Maybe Bob can confirm.

Here’s the key code of the Run() method of the UIThread object:

Var progressValue As Integer

While progressValue < 100
  progressValue = progressValue + 1
  
  // Do some long-running process
  LongRunningMethod
  
  // Call UpdateUI with any parameters you need. This calls the UpdateUI event handler
  // where you can directly access any UI controls on the Window.
  
  // This specifies simple parameters using a Pair
  // You can also pass values using a Dictionary
  Me.AddUserInterfaceUpdate("UIProgress":progressValue)
  
Wend

This Xojo example looks like a great solution. I would like to turn it into a reusable class for Progress Bar. Has anyone done this, or can you make any suggestions? I’m not sure how to do this.