Recent

Author Topic: Show progress dialog before showing main form  (Read 2293 times)

kinu

  • New Member
  • *
  • Posts: 14
Show progress dialog before showing main form
« 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?
« Last Edit: October 18, 2021, 02:43:26 pm by kinu »

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Show progress dialog before showing main form
« Reply #1 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.
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

kinu

  • New Member
  • *
  • Posts: 14
Re: Show progress dialog before showing main form
« Reply #2 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!!!!!
« Last Edit: October 19, 2021, 09:09:04 am by kinu »

 

TinyPortal © 2005-2018