Ask Your Question
3

How to display a form or a "please wait" panel while executing a task in FMX Delphi 10.2?

asked 2022-01-16 11:00:00 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-12-30 23:00:00 +0000

bukephalos gravatar image

To display a form or a "please wait" panel while executing a task in FMX Delphi 10.2, you can follow these steps:

  1. Create a new form or panel with a label or message informing the user that the application is processing a task and they should wait.
  2. Set the visibility property of this form/panel to false in the Object Inspector.
  3. In your main form, create a function or procedure that executes the task you want to perform while displaying the "please wait" panel or form.
  4. In this function, set the visibility property of the "please wait" panel or form to true.
  5. After the task is completed, set the visibility property of the "please wait" panel or form back to false.
  6. Call your processing function wherever you need it in your application.

Example:

Assuming you have a "frmPleaseWait" form with a "lblMessage" label, and your processing function is "ExecuteTask":

procedure TForm1.ExecuteTask;
begin
  try
    frmPleaseWait.lblMessage.Text := 'Processing...'; // Update the message displayed in the "please wait" form.
    frmPleaseWait.Visible := true; // Show the "please wait" form.
    // ... perform your task ...
  finally
    frmPleaseWait.Visible := false; // Hide the "please wait" form after the task is completed.
  end;
end;

You can then call this function wherever you need it in your application, for example:

procedure TForm1.btnProcessClick(Sender: TObject);
begin
  ExecuteTask;
end;

This will display the "please wait" form while the task is executed, and hide it afterwards.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-16 11:00:00 +0000

Seen: 9 times

Last updated: Dec 30 '21