Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Correct usage of ShowProgress / HideProgress
Sat, Apr 6 2019 9:46 AMPermanent Link

Bill

Hi all,
sorry for newbes question but I need a simple example of correct usage of ShowProgress.
My use case is the following:
I have a grid that exposes a query result, user select a row and espect open a new form with details about his selection. The form is quite complex (has many visual controls in a multi PagePanel container) and execute at least 10 different queries on different databases so it needs some seconds to design and fill.
I do the following operation in an event connected to rowSelect in the first form:

 ShowProgress('Bla Bla...');
 newForm := TnewForm.Create(Self);
 Form.Show();
 OpenFirstDataset;

If I call ShowProgress(), message appear only after showing newForm.
What is the right way to show progress message immediately after calling and, obvoiusly, before creating newForm?

Thanks in advance
Mon, Apr 8 2019 3:55 AMPermanent Link

Matthew Jones

Bill wrote:

> What is the right way to show progress message immediately after calling and, obvoiusly, before creating newForm?

The key is that the UI will only update when you hand control back to the browser. Thus you must do the show progress, and then pause before you do the rest. The easiest way to do this is to put the rest in a new procedure, and call that async. That then makes it happen "later" when nothing else is happening. The alternative is a timer, which can have a very short time.

--

Matthew Jones
Image