Recent

Author Topic: Show progress dialog before showing main form  (Read 1942 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: 763
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.
29.12.2021 - migration to DynamicData 4.1 is completed - complete overhaul of data access driver.
My project still requires full Delphi 2009 support to be ported to Lazarus.
It's time to finally do it, because Delphi 2009 is 13 years old.

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