Dim Out the Main Form of an Application When Modal Form is Displayed
Monday May 19, 2008
in Delphi TIPS ::
Dialog windows you use to display critical information to the user are, in most cases, displayed modally. A modal form is one where the application can't continue to run until the modal (information) form is closed. Delphi's ShowMessage, InputBox and MessageDlg, for example, display a modal form to the user waiting for some action.
Dialog windows you use to display critical information to the user are, in most cases, displayed modally. A modal form is one where the application can't continue to run until the modal (information) form is closed. Delphi's ShowMessage, InputBox and MessageDlg, for example, display a modal form to the user waiting for some action.
To emphasize the importance of a modal form and the information it presents, you could gray out the main form of the application when the modal form is activated.
Read the full article to learn how to Dim Out the Main Form of an Application When Modal Form is Displayed.
Related:


Comments
Wouldn’t work very well on Windows XP. The “dimmer” form would have rectangular edges, while the form it’s dimming has rounded edges at the top. So it would dim more than just your window.
My TApplicationEvents doesn’t have an OnModalBegin or End.
Like the idea, but my version of TapplicationEvents does not have the onModalBegin nor the onModalEnd events. (D7)
I’ll try hooking it via window message?
Thanks
http://delphi.newswhat.com/geoxml/forumgetthread?groupname=borland.public.delphi.rtl.win32&messageid=MPG.228c2e8f4296579f9897f0@newsgroups.borland.com&displaymode=all
DOH! too simple.
private
procedure FormModalBegin(Sender: TObject);
procedure FormModalEnd(Sender: TObject);
…
procedure TMainForm.FormCreate(Sender: TObject);
begin
Application.OnModalBegin := FormModalBegin;
Application.OnModalEnd := FormModalEnd;
…
procedure TMainForm.FormModalBegin(Sender: TObject);
begin
DimmerForm.DimDisplay;
end;
procedure TMainForm.FormModalEnd(Sender: TObject);
begin
DimmerForm.Hide;
end;
Hope this helps
I’ve tried this, and I also cannot get it to work, even with Ron’s code - it won’t compile, giving an ‘undeclared identifier’ when it hits the ‘onModalBegin’ part.. any suggestions? I’m using D6