How can I change or update the value of a TextField dynamically

I wanr to change dinamicatly the value of a TextField, several times in the same process, how can I do it?

ex:

  @Subscribe("importBtn")
  public void onTestButtonClick(final ClickEvent<JmixButton> event) {
    processQtyField.setValue(1);
    eventPublisher.publishEventForCurrentUI(new FooChangedEvent(this));

    try {
      Thread.sleep(5 * 1000);
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
    }

    processQtyField.setValue(2);
  }

In the example, the value “1” is never showed, only is showed value “2”. Maybe is really basic, but I can found the correct method to do it. Any idea?
Thanks, Alvaro

Hi,

You need to start a background task (see doc) for a long-running task and, after it’s completed, update the TextField value.

Regards,
Gleb

Thanks very much it works for me.