Board index » delphi » ShowModal!?

ShowModal!?

Hi.
I use Delphi 1.0.  In my program, I do:
procedure TMainForm1.Load1Click(Sender: TObject);
var
  LoadForm1 : TLoadForm1;
begin
  LoadForm1 := TLoadForm1.Create (Self);
  LoadForm1.Top := 0;
  LoadForm1.Left := 0;
  LoadForm1.ShowModal;
  LoadForm1.Free;
end;
LoadForm is not displayed automatically after it is created, just as I
would expect.  Which version of Delphi are you using?  And, sorry to ask
this, but are you sure your Form1 is not autocreated at start time?
Darya.  

Quote
Brian Pedersen wrote:

> > My question is then; why does the
> > line form1:=TForm1.Create(self) also
> > automatically show the form?

> Good question...

> > I have to add form1.hide
> > before executing form1.showmodal.
> > The form has no FormCreate event that shows it.
> > Could it be something else that I'm missing?

> You probably should use form1.close if the form is allready showed.

> --
> Brian Pedersen, System Specialist, Alta Copenhagen
> http://www.alta.dk
> Personal homepage:
> http://home6.inet.tele.dk/brianp

> Get PR-Tracker -- tracks problem reports, defects, bugs
> INFORMATION:  http://www.prtracker.com/info.html
> DOWNLOAD:     http://www.prtracker.com/download.html

 

Re:ShowModal!?


Have you tried setting TForm1 Visible property to False on the Object
Inspector?

Re:ShowModal!?


Quote
Tommy Nordvik (to...@fossekall.ii.uib.no) wrote:

: One of my forms behave strangely.
: I execute the following code:
:    form1:=TForm1.Create(self);
:    form1.showmodal;  
: This genereates an error saying: Cannot
: make a visible window modal.

: My question is then; why does the
: line form1:=TForm1.Create(self) also
: automatically show the form?

: I have to add form1.hide
: before executing form1.showmodal.
: The form has no FormCreate event that shows it.
: Could it be something else that I'm missing?

: ANy help would be greatly appreciated.

: -Tommy        

Maybe your form is being auto created by Delphi at startup.  Check in the
Project/Options menu to see if it is.

Other Threads