HISE Logo Forum
    • Categories
    • Register
    • Login

    File.copy locks UI thread - how to show progress?

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 171 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by

      I have a loop that copies say 10 files from one folder to another. I'd like to show a progress bar so the user can see how many files have been copied.

      I can print the progress to the console without issue and even assign the progress to a panel. But I'm unable to repaint the panel because the copy method seems to block the UI thread.

      What can I do about it? Can we move the copy command to the loading thread? Or perhaps give it a progress callback like the extractZipFile command?

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @d.healey
        last edited by

        @d-healey Have you tried a background task? Since it uses another thread...

        Can't help pressing F5 in the forum...

        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @ustk
          last edited by

          @ustk For the copy or for the progress bar? I remember a while back using a background thread for something and it caused my plugin to crash, I haven't played with them since.

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 1
          • d.healeyD
            d.healey
            last edited by

            Putting the move function onto a background thread seems to have done the trick! Just need to test it on each OS to make sure it's stable :)

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            A 1 Reply Last reply Reply Quote 1
            • A
              aaronventure @d.healey
              last edited by

              @d-healey BackgroundTask is amazing, it unlocks a whole new world with e.g. python access.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post

              28

              Online

              1.8k

              Users

              12.0k

              Topics

              104.4k

              Posts