Task.UpdateUI method

From Xojo Documentation

Method

Task.UpdateUI(args As Dictionary)

Supported for all project types and targets.

Calls the UpdateUI event handler where you can update the user interface. Pass in necessary arguments as a Dictionary.


Method

Task.UpdateUI(paramarray args As Pair)

Supported for all project types and targets.

Calls the UpdateUI event handler where you can update the user interface. Pass in necessary arguments as a Pair.

Notes

In the Run method of the Task subclass, call the UpdateUI method to supply arguments that will be sent to the UpdateUI event handler where you can directly update the user interface.


Examples

This code updates a ProgressBar passing in the value to use as a Pair:

Dim progressValue As Integer

While progressValue < 100
progressValue = progressValue + 1

// Do nothing for 1/4 second or so so folks can see the actual progress
Dim waitUntil As Integer = Ticks + 15

While Ticks < waitUntil
Wend

// 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.UpdateUI("UIProgress":progressValue)

Wend

This code updates a ProgressBar passing in the value to use as a Dictionary:

Dim progressValue As Integer

While progressValue < 100
progressValue = progressValue + 1

// Do nothing for 1/4 second or so so folks can see the actual progress
Dim waitUntil As Integer = Ticks + 15

While Ticks < waitUntil
Wend

// Call UpdateUI with any parameters you need. This calls the UpdateUI event handler
// where you can directly access any UI controls on the Window.
Dim d As New Dictionary
d.Value("UIProgress") = progressValue
Me.UpdateUI(d)

Wend