How to Auto pop-up a dialog AFTER the main form is shown?

4172 views delphi

I am using Delphi XE3. Now I need to pop-up a dialog AFTER the main form is shown.

I try to put the codes in FormShow event handler of the main form, as follows:

    with TMyChildForm.Create(Self) do

However, this will cause the ChildForm to be pop-up BEFORE the main form is shown.

answered question

1 Answer


You need to delay showing the popup form until AFTER OnShow has exited. You can either:

  • use a short timer.
  • PostMessage() a custom window message to yourself.
  • use TThread.CreateAnonymousThread() or TTask to call TThread.Queue().
  • use TThread.ForceQueue() (10.2 Tokyo and later only).

posted this

Have an answer?


Please login first before posting an answer.