Skip to Content
Author's profile photo Former Member

Progress information in a shared object.

I have known for a long time that you can register an nvo as a shared object and have it run in a separate thread, but never really never paid it much attention.

In my mind a shared object was meant for background processes, so the user didn’t have to wait, whilst long winded retrievals or other processing took place. But what if the process was not a database process that blocks the main thread. What if the process was mainly in the client in the main thread and it was acceptable for the user to wait as long as he or she could see the process progressing?  Then all we do is setmicrohelp and set arrow to hourglass!.  We might even create a little window with a progress bar and post progress to it… Trouble is; when the showing progress is competing with the real process; as soon as the user clicks anywhere to see what is happening, the whole thing goes pale and the progress window stops showing progress.


After a bit of experimenting I discovered that you can actually open a window from a shared object.  This window, happily opens and is running in a different thread, is responsive and a perfect candidate for a progress window.


To open a progress window in a different thread, create and nvo with a couple of functions to set progress and messages, instantiate it using SharedObjectRegister and code it to open the progress window when it is call upon to show progress…


Example: w_main with invShared as instance variable instantiated in the Open event.


SharedObject1.PNG


Pretend process with calls to the progress window via invShared:


note that the invShared instance variable ibCancel can be interrogated between steps.

SharedObject2.PNG


SharedObject3.PNG

SharedObject3a.PNG


SharedObject4.PNG

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Lars

      It look very interesting

      May I get a copy of your PBL to test it in my proyect.
      Thanks, I appreciate yiu help

      Author's profile photo David Peace
      David Peace

      Interesting...

      I have always made callbacks to the main thread to show progress. I like this because it is separate from the main application and all that it is busy with.

      Nice one 🙂