Threading Problem

Apr 7 2009 6:18 AM
Hi, 

I have a rather peculiar problem.
I have a 'view' library which loads and saves the users last view settings, i.e. how the application looked when the user was last using the system. I store these view properties in xml. no problem there.

It does however take a while to load and save a view as there is a lot of validation occurring which slows the load/save down considerably, this is just because of the sheer quantity of information.  This leads to the program appearing to freeze for a few seconds, this is bad.

To combat this, what I am trying to do is make a progress dialog containing a progress bar appear when views are being loaded or saved. I just want to show an indication of the system working to the user, as there is no defined limit to the loading and saving operation. Therefore I have decided to use a marquee style progress bar.

In order to get the progressbar to draw and not to freeze (like the rest of the application) I originally tried moving the load/save view into another thread, but soon found this is not possible as the load/save was unable to set properties on gui components which were not created within it's own thread. 

I then tried to put the progress bar in a seperate thread and display it in the centre of the screen, but it does not appear (Possibly because it is in a seperate thread).

Any help with this situation would be much appreciated.

Cheers

Alex

Answers (3)