Board index » delphi » Stopping my application until a form is correctly shown

Stopping my application until a form is correctly shown

    I want to use a form saying "Wait a moment please" while pogram
completes a connection to a remote DataBase. My problem is that
the program begins to make the connection before displaying correctly
this form (and its labels).
I didn't find any kind of a "pause(seconds)" that exists in Pascal or C
equivalent: "sleep(seconds)" to stop the application in order to display
the form correctly (I think it should work). I also tried a "for" loop
but it doesn't work.
    Do any one knows how can I display this form correctly before the
database connection begins running ?

    Thank you,

            Adelino Rocha.

 

Re:Stopping my application until a form is correctly shown


Try
          Application.ProcessMessages;

after you have done the form show but before you do the database connect.
See the help for details.

Quote
Adelino Rocha wrote:
>     I want to use a form saying "Wait a moment please" while pogram
> completes a connection to a remote DataBase. My problem is that
> the program begins to make the connection before displaying correctly
> this form (and its labels).
> I didn't find any kind of a "pause(seconds)" that exists in Pascal or C
> equivalent: "sleep(seconds)" to stop the application in order to display
> the form correctly (I think it should work). I also tried a "for" loop
> but it doesn't work.
>     Do any one knows how can I display this form correctly before the
> database connection begins running ?

>     Thank you,

>             Adelino Rocha.

Re:Stopping my application until a form is correctly shown


I had a similar situation where I created a form with a message in a label,
before some calculation was started. As far as I remember the form was
shown, but the label was not. Then I called Labelx.Update, and it helped.

Maybe in your case, you should also call Formx.Update;

Bruno

Re:Stopping my application until a form is correctly shown


Dear Adelino.........................

Are the databases automaticlly created?  I have a load screen that opens
first and displays what form or table is being loaded.  But here is the
trick.  The load screen is loaded in the project source and is NOT auto
created.  Here is the example:

  frmLoading := TfrmLoading.Create(Application);
  frmLoading.txtDisplay.Caption := 'Loading Scan Center';
  frmLoading.Show;
  frmLoading.Refresh;

  Application.Initialize;
  Application.Title := 'PROJECT';
  Application.CreateForm(TfrmMain, frmMain); //This is your main form
  Application.CreateForm(TDBS, DBS); //This is my TDataModule
  frmLoading.Hide;
  frmLoading.Free;
  Application.Run;

This way it opens before the main or first form.  And on the create of that
form I send
information to frmLoading.txtDisplay.Caption and on the openning of each
table.  That way I can see what is going on.

Something to think about......Good luck.

Quote
>  I want to use a form saying "Wait a moment please" while pogram
> completes a connection to a remote DataBase. My problem is that
> the program begins to make the connection before displaying correctly
> this form (and its labels).
> I didn't find any kind of a "pause(seconds)" that exists in Pascal or C
> equivalent: "sleep(seconds)" to stop the application in order to display
> the form correctly (I think it should work). I also tried a "for" loop
> but it doesn't work.
>     Do any one knows how can I display this form correctly before the
> database connection begins running ?

>     Thank you,

>             Adelino Rocha.

--
Brian Malooley @ Xanatek, Inc.
Email: bri...@Xanatek.com
http://www.Xanatek.com
Voice: (219) 287-9938
Fax:   (219) 287-9958

Re:Stopping my application until a form is correctly shown


Call

Application.ProcessMessages;

--
Bill Todd (TeamB)
(Questions received via email cannot be answered.)

Other Threads