Re:simple question - D1 - taskbar icon with modal forms
Quote
>I've seen this posted before but couldn't find any references to it. Hope
>someone can help me with it.
>I open a modal form in my app. I then switch to a different app and want
to
>come back to the orig. app. If I select the task bar icon it returns to my
>main app but the modal form is not visible (is behind the main form) and
the
>app is locked up. You can return to the modal form using alt tab but my
>preference would be to have the modal form come back when the task bar icon
>is selected.
Create an OnActivate handler...
public
procedure ApplicationActivate(Sender: TObject);
Set it in the FormCreate...
Application.OnActivate := ApplicationActivate;
...and modify this code as needed...
procedure TMain.ApplicationActivate(Sender: TObject);
begin
{If the user moves to another program and returns, be sure
that any modal forms are on top! }
if Frm_Setup.visible then frm_setup.bringtofront;
if Frm_Btn1.visible then frm_btn1.bringtofront;
if Frm_About.visible then frm_about.bringtofront;
if Frm_Package.visible then frm_package.bringtofront;
if Frm_Inserts.visible then frm_inserts.bringtofront;
if Frm_Calculate.visible then frm_calculate.bringtofront;
if Frm_Match.visible then frm_match.bringtofront;
end;
Eric Lawrence
Applications Architect
Bayden Systems
delta...@wam.umd.edu
----------------------------------------------------------------------------
--
"A strange game. The only winning move is not to play."
----------------------------------------------------------------------------
--