Board index » delphi » MDI application and modal forms

MDI application and modal forms

        I also have the same problem if I try to use a modal form : I create it
, myForm := create (TmyForm), but when I try to add myForm.ShowModal, an error
happens, and I am said that a form which is already visible can't be opened as
a modal form. The problem seems to be the same : as soon as I use the create
command, the form appears, even if I don't use a show command.

        If you can explain me the reason why, this could be really very
helpful. Thanks, my e-mail is duran...@worldent.fr

 

Re:MDI application and modal forms


Quote
gouy wrote:

[snip]

Quote
> a modal form. The problem seems to be the same : as soon as I use the create
> command, the form appears, even if I don't use a show command.

Set visible to false.  Then explicitly call Show or ShowModal to display
it.

Re:MDI application and modal forms


gouy <duran...@worldnet.fr> wrote in article
<5mkv9a$7m...@storm.worldnet.net>...

Quote

>    I also have the same problem if I try to use a modal form : I create it
> , myForm := create (TmyForm), but when I try to add myForm.ShowModal, an
error
> happens, and I am said that a form which is already visible can't be
opened as
> a modal form. The problem seems to be the same : as soon as I use the
create
> command, the form appears, even if I don't use a show command.

>    If you can explain me the reason why, this could be really very
> helpful. Thanks, my e-mail is duran...@worldent.fr

Try this!

myForm := TmyForm.Create(self);

then you can show it any way you want  (modally, non-modally)

cheers

Re:MDI application and modal forms


Quote
Jim Hack wrote:

> gouy <duran...@worldnet.fr> wrote in article
> <5mkv9a$7m...@storm.worldnet.net>...

> >       I also have the same problem if I try to use a modal form : I create it
> > , myForm := create (TmyForm), but when I try to add myForm.ShowModal, an
> error
> > happens, and I am said that a form which is already visible can't be
> opened as
> > a modal form. The problem seems to be the same : as soon as I use the
> create
> > command, the form appears, even if I don't use a show command.

> >       If you can explain me the reason why, this could be really very
> > helpful. Thanks, my e-mail is duran...@worldent.fr

> Try this!

> myForm := TmyForm.Create(self);

> then you can show it any way you want  (modally, non-modally)

> cheers

Or even better -- 'cause you might want to change properties at
run-time...

with TfmMyForm.Create(Self) do
  begin
    Caption := 'Anything you want';
    Show;
  end;

Other Threads