Re: Making Delphi program POP UP.
Posted by webmaster Guido on April 03, 2001 at 22:48:27:
In Reply to: Making the program POP UP. posted by James McLain on March 28, 2001 at 07:47:25:
: There seems to be a bug in the FormState property or forms. I have an app that I would like to POP UP. Setting the window stat to fsNormal, does nothing if the form is minimized. But changing to fsMaximized does work. So what I am doing in my code is making the form invisible, maximizing it, and the normalizing it, the making it visible again. This works BUT. For some reason after I do this, the minimize button on the form doesn't work anymore. Anyone know why this is, and how I can correct it? Here's my code:
If not convo.active then
: convo is the name of the form I'm poping up.
Setting the window state to fsNormal only restores the form if the form was minimized with TheForm.WindowState := wsMinimized.
So, the code for "restoring" the mai n form depends from was whether your application was minimized, or your main form was minimized, or your main form was hidden. The following example will allways "pop up" the main form, because it checks both the state of the application and the state of the form:
if not Application.Active then Application.Restore; if not FormMain.Visible then FormMain.Show; if FormMain.WindowState <> wsNormal then FormMain.WindowState := wsNormal;