Help display ProgressBar while ChildForm loads

  • Thread starter Thread starter Viking2000
  • Start date Start date
V

Viking2000

Hi I hope I have the right group for this.
I have an MDI form, and some of the child forms take awhile to load
because they are data heavy. I want to display a Progressbar so that
the user has an idea that something is still happening. I know the
average time for loading for each form, so I can make the ProgressBar
fairly accurate. Also each child form can be written by a different
group so I need to keep the amount of special code they implement to a
minimum,
I know this requires threading but I am running into some issues.
1) Loading the Child Form in the main thread, calling ProgressBar
update in another thread. It appears that all screen updates only
happen in the main thread, so all the screen updates get queued, until
the form is completed, so this does not give any useful display.
2) Load the child form in another thread, keeping the main thread
unencumbered to do things like screen updates. This works pretty well
except that I can not attach the child form to the MWI Parent because
it is owned by a different thread at this point.
So my problem is the child form must load in the main thread, all
screen updates must happen in the main thread. How do I interrupt the
main thread while loading so that I can force screen updates? Or am I
taking the wrong path, and is there another method I should be looking
into?

Thank you
 
Viking,

Your first problem is, that a progresbar assumes that you have a begin and
an end, I don't see what is that in your question.

Do it likes Microsoft does mostly, simple show an AVI.

By the way, although this is a developper newsgroup is your question highly
program language depended (VB has some extras too make multhithreading
easier).

Therefore you are probably better of in one of the language newsgroups which
you are using.

Cor
 
Viking2000 said:
Hi I hope I have the right group for this.
I have an MDI form, and some of the child forms take awhile to load
because they are data heavy. I want to display a Progressbar so that
the user has an idea that something is still happening. I know the
average time for loading for each form, so I can make the ProgressBar
fairly accurate. Also each child form can be written by a different
group so I need to keep the amount of special code they implement to a
minimum,
I know this requires threading but I am running into some issues.
1) Loading the Child Form in the main thread, calling ProgressBar
update in another thread. It appears that all screen updates only
happen in the main thread, so all the screen updates get queued, until
the form is completed, so this does not give any useful display.
2) Load the child form in another thread, keeping the main thread
unencumbered to do things like screen updates. This works pretty well
except that I can not attach the child form to the MWI Parent because
it is owned by a different thread at this point.
So my problem is the child form must load in the main thread, all
screen updates must happen in the main thread. How do I interrupt the
main thread while loading so that I can force screen updates? Or am I
taking the wrong path, and is there another method I should be looking
into?

Thank you

3)

Load the Child Form normally, but do not perform heavy initialization during
load. Put an all covering panel in front of all controls (or just hide or
disable everything) and display a progress bar on the panel or in an
otherwise suitable place. Have the Child Control do the heavy initialization
in a separate thread (BackgroundWorker) and hide the panel/show everything
else when the initialization is done.

As Cor said, you are better off in a language specific group as the general
group attracts loads of off topic posts to such a degree that relevant posts
often drown.
 
Back
Top