This is a classic problem and the solution is very simple
Declare CreateParams procedure of the form and override the following values
in it
procedure TFrmModalAncestor.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
FormStyle := fsNormal;
Visible := false;
end
end;
class function TFrmModalAncestor.LaunchFormAsModal(const aCaption: string =
''): TModalResult;
var
vForm: TFrmModalAncestor;begin
Screen.Cursor := crHourGlass;
try
Application.CreateForm (Self,vForm);
vForm.Caption := aCaption;
Result := vForm.ShowModal;
finally
Screen.Cursor := crDefault;
vForm.Release;
end;
end;
And then I can launch any modal form (which inherits from an ancestor modal
form) by calling the class function: TmyModal.LaunchFormAsModal('my modal
form');
Either you have to do this or after creating the form in the way you are
set visibility to false and then call the ShowModal method which of course
would not be the best way to do things because you will see your form
flickering upon creation....
Hope this helps
Vahan
-----Original Message-----
From: David Smith [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 05, 2005 10:19 PM
To: [email protected]
Subject: Re: [delphi-en] cannot make a visible window modal
I've you've got a tab control on that form and it is set to an invisible
page at designtime, that is one reason that could be causing it. Look for
window that has it's visibility property set to false that you are trying to
show.
DJS
tarniadi <[EMAIL PROTECTED]> wrote:
Hi all,
Can someone tell me hhat's the problem with the below error messege:
"Cannot make a visible window modal"
wich appears when I want to ShowModal a form that I created in the
previous line as follows:
frmFirstEditForm := TfrmFirstEditForm.CreateWithParameters
(SomeWord,SomeEnumeratedType,Self);
frmFirstEditForm.ShowModal;
frmFirstEditForm.Close;
Adrian
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Better first dates. More second dates. Yahoo! Personals
[Non-text portions of this message have been removed]
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
----------------------------------------------------------------------------
----
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
b.. To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/