Lazarus

Programming => General => Topic started by: kinu on October 18, 2021, 02:40:45 pm

Title: Show progress dialog before showing main form
Post by: kinu on October 18, 2021, 02:40:45 pm
Hello!

In my main form OnShow I execute a long query, so I want to show a dialog with a progress bar or maybe only a label "Loading...." while executing the query.

So I put in my FormShow procedure something like this:

Code: Pascal  [Select][+][-]
  1.   FormProgress.Show;
  2.   MyQuery;
  3.   FormProgress.Hide;

And it shows an empty form. No label, nothing, just white background. FormProgress is created in application initialization. If I don't hide the form, it shows the 'Loading...' label when query is completed and main form is showed. Why?
Title: Re: Show progress dialog before showing main form
Post by: Mr.Madguy on October 18, 2021, 02:50:17 pm
Messages aren't processed. If query doesn't allow some sort of progress event, that would allow you to execute Application.ProcessMessages, then only option - is to execute query in another thread.
Title: Re: Show progress dialog before showing main form
Post by: kinu on October 19, 2021, 08:54:30 am
Messages aren't processed. If query doesn't allow some sort of progress event, that would allow you to execute Application.ProcessMessages, then only option - is to execute query in another thread.

Ok, I will try. If it doesn't work, I'll learn the thread thing to get it working. Thank you very much!

EDIT: Well, Application.ProcessMessages in AfterScroll event worked fine!!!!!
TinyPortal © 2005-2018