MEGA Search
20.3 Million


Sign Up
From: Ari Adrianto  
Subject: Cannot Make Visible Window Modal Error
NewsGroup: borland.public.delphi.students
Date Posted: 11-Apr-2003 at 15:12:15 PST
Hi All,
I'm using Delphi 6.
I have a problem.. my form always showing the error message :

"Cannot Make Visible Window Modal".

I've try to search whats wrong, but I can't find it.
All I have to do is creating new form and copy this broken form into new
form.
But I think this is not a wise solution, because another form has a lot of
event that can't only be pasted into new form.
Is it possible my form broken ? or Else ?


Best Rgds,
Ari Adrianto



From: Sierra Spartacus  
Subject: Re: Cannot Make Visible Window Modal Error
NewsGroup: borland.public.delphi.students
Date Posted: 11-Apr-2003 at 7:23:1 PST
"Ari Adrianto"  wrote in message
news:3e967715$1@newsgroups.borland.com...
> Hi All,
> I'm using Delphi 6.
> I have a problem.. my form always showing the error message :
>
> "Cannot Make Visible Window Modal".

From my tome:
Cannot make a visible window modal
Possible Cause of Error
1. You may have called a form's ShowModal method after it had already been
created.
2. You may have set a form's visible property to True when it was already
visible.
Quick Fix
1. Do not call a form's ShowModal method unless you are creating it
dynamically.
2. Do not set a form's visible property to True if is already visible. If
the form's visible property is True in the IDE, set it to False (in the
IDE).
Additional Information
1. When a form is created automatically by Delphi (such as all forms are by
default and an application's main form always is), Delphi changes the form's
Visible property from False to True.
The only time you should (and must) call either a form's Show or ShowModal
method is when creating the form dynamically. Creating forms dynamically is
recommended for forms which may not be opened every time an application is
instantiated (such as an About Box).
To create a form dynamically, follow these steps:
1. Select View | Project Manager
2. Select the Options button
3. Highlight the form you want to create dynamically in the Auto-create
forms listbox
4. Move it to the Available Forms list box by clicking the right-arrow
5. Select the OK button
6. Add code patterned after the following to the event of your choice
(replace AboutBox with the form's instance variable name and TAboutBox with
the form's class name):
procedure TForm1.AboutBoxClick(Sender:
                                     Tobject);
begin
  AboutBox := TAboutBox.Create(nil);
  try
    AboutBox.ShowModal;
  finally
    AboutBox.Free;
    AboutBox := nil;
  end;
end;
Note: If you display a window "modally" (as most Dialog Boxes are, such as
TOpenDialog and TSaveDialog), the user must respond to it before resuming
other activities within the program. Windows that are not modal, such as a
floating toolbar, can remain open throughout the run of an application.
2. The default value for an SDI child form's visible property is True. If
you change a form's FormStyle property from fsMDIChild, it will remain True.
Attempting then to Show or ShowModal it will give you this error. Change the
visible property back to False in the IDE to prevent this.

--

Clay Shannon, author of "the Wacky Misadventures of Warble McGorkle"
(download it at http://www.winsite.com/bin/Info?12500000036639)



From: Andrew Muir  
Subject: Re: Cannot Make Visible Window Modal Error
NewsGroup: borland.public.delphi.students
Date Posted: 11-Apr-2003 at 17:39:39 PST
make sure your form.visible is set to false
is your form auto-created ?

"Ari Adrianto"  wrote in message
news:3e967715$1@newsgroups.borland.com...
> Hi All,
> I'm using Delphi 6.
> I have a problem.. my form always showing the error message :
>
> "Cannot Make Visible Window Modal".
>
> I've try to search whats wrong, but I can't find it.
> All I have to do is creating new form and copy this broken form into new
> form.
> But I think this is not a wise solution, because another form has a lot of
> event that can't only be pasted into new form.
> Is it possible my form broken ? or Else ?
>
>
> Best Rgds,
> Ari Adrianto
>
>



From: Ari Adrianto  
Subject: Re: Cannot Make Visible Window Modal Error
NewsGroup: borland.public.delphi.students
Date Posted: 12-Apr-2003 at 10:54:33 PST
My form is not auto-created.
I usually delete "application.createform(...)" from DPR file, rather than
using Project Options to make my form available (from auto-create form).

Then, I put it back (using project options) to auto-create form, and put it
back again into available form.
Set the form visible to false and it works, no more error message.


Thanks..
Ari Adrianto